コード例 #1
0
 public classVideo(string NuevoTitulo, string NuevaURL)
 {
     this.Titulo = NuevoTitulo;
     this.URL    = NuevaURL;
     this.Tags   = new List <string>();
     this.Estado = VideoStatus.Parado;
 }
コード例 #2
0
        // Event handler to update status
        void OnUpdateStatus(object sender, EventArgs args)
        {
            VideoStatus videoStatus = VideoStatus.NotReady;

            switch (player.Status)
            {
            case AVPlayerStatus.ReadyToPlay:
                switch (player.TimeControlStatus)
                {
                case AVPlayerTimeControlStatus.Playing:
                    videoStatus = VideoStatus.Playing;
                    break;

                case AVPlayerTimeControlStatus.Paused:
                    videoStatus = VideoStatus.Paused;
                    break;
                }
                break;
            }
            ((IVideoPlayerController)Element).Status = videoStatus;

            if (playerItem != null)
            {
                ((IVideoPlayerController)Element).Duration = ConvertTime(playerItem.Duration);
                ((IElementController)Element).SetValueFromRenderer(VideoPlayer.PositionProperty, ConvertTime(playerItem.CurrentTime));
            }
        }
コード例 #3
0
        // Event handler to update status
        void OnUpdateStatus(object sender, EventArgs args)
        {
            VideoStatus status = VideoStatus.NotReady;

            if (isPrepared)
            {
                switch (ExoPlayer.PlaybackState)
                {
                case Player.StateIdle:
                    status = VideoStatus.Paused;
                    break;

                case Player.StateEnded:
                    status = VideoStatus.Ended;
                    break;

                case Player.StateReady:
                    status = VideoStatus.Playing;
                    break;
                }
            }

            ((IVideoPlayerController)Element).Status = status;

            // Set Position property
            // TimeSpan timeSpan = TimeSpan.FromMilliseconds(videoView.CurrentPosition);
            // ((IElementController)Element).SetValueFromRenderer(VideoPlayer.PositionProperty, timeSpan);
        }
コード例 #4
0
        private void RefreshVideoStatus(VideoStatus _default)
        {
            // Temporaryの有無でプロパティを変更
            var tmp = NicoUtil.Temporaries.FirstOrDefault(x => x.VideoId == VideoId);

            if (tmp != null)
            {
                IsTemporary = true;
                TempTime    = tmp.Date;
            }
            else
            {
                IsTemporary = false;
            }

            Status = NicoUtil.Histories.Any(x => x.VideoId == VideoId)
                ? VideoStatus.See
                : NicoUtil.Temporaries.Any(x => x.VideoId == VideoId && MainViewModel.Instance.LoadingTime < x.Date)
                ? VideoStatus.New
                : NicoUtil.Temporaries.Any(x => x.VideoId == VideoId)
                ? VideoStatus.Temporary
                : _default;

            StatusString = Status.GetLabel();
        }
コード例 #5
0
ファイル: Video.cs プロジェクト: omunizb/videos.NET
        public void SetStatus(VideoStatus action)
        {
            switch (action)
            {
            case VideoStatus.AddTag:
                Console.WriteLine("Which tag would you like to add?");
                break;

            case VideoStatus.Play:
                Console.WriteLine("The video is playing!");
                this.Status = VideoStatus.Play;
                break;

            case VideoStatus.Pause:
                Console.WriteLine("Video paused");
                this.Status = VideoStatus.Pause;
                break;

            case VideoStatus.Stop:
                Console.WriteLine("Stopped video reproduction");
                this.Status = VideoStatus.Stop;
                break;

            default:
                Console.WriteLine("Invalid command");
                break;
            }
        }
コード例 #6
0
        /// <summary>
        ///     根据状态查找视频
        /// </summary>
        /// <returns></returns>
        public IPagedList <VideoEx> GetVideoByStatus(VideoStatus status, int pageIndex = 0, int pageSize = int.MaxValue)
        {
            var query = from v in _videoRepository.GetAll()
                        join u in _userRepository.GetAll() on v.PublishUserId equals u.Id
                        join ua in _userAvatarRepository.GetAll() on u.Id equals ua.UserId into uaTemp
                        from uaEmpty in uaTemp.DefaultIfEmpty()
                        where v.Status == status
                        select new VideoEx
            {
                Id                         = v.Id,
                Title                      = v.Title,
                StreamMediaPath            = v.StreamMediaPath,
                EstimatedStartTime         = v.EstimatedStartTime,
                ActualStartTime            = v.ActualStartTime,
                ActualEndTime              = v.ActualEndTime,
                Status                     = v.Status,
                PublishUserId              = v.PublishUserId,
                limelightCount             = v.limelightCount,
                LiveRoomId                 = v.LiveRoomId,
                ChatRoomId                 = v.ChatRoomId,
                LivePreviewImagePath       = v.LivePreviewImagePath,
                PublishUserName            = u.Name,
                PublishUserAvatarImagePath = uaEmpty.ImageFilePath
            };

            query = query.OrderBy(x => x.Id);

            var videos = new PagedList <VideoEx>(query, pageIndex, pageSize);

            return(videos);
        }
コード例 #7
0
        void OnMediaElementCurrentStateChanged(object sender, RoutedEventArgs args)
        {
            VideoStatus videoStatus = VideoStatus.NotReady;

            //TODO

            ((IVideoPlayerController)Element).Status = videoStatus;
        }
コード例 #8
0
ファイル: Video.cs プロジェクト: vanyok1991/tubesave
        public Video(string title, string path)
        {
            Title  = title;
            Path   = path;
            Status = VideoStatus.Open;

            Id = Guid.NewGuid().ToString();
        }
コード例 #9
0
ファイル: Booking.cs プロジェクト: esi1/DotNet
 public Dictionary <int, IVideo> GetVideos(VideoStatus status)
 {
     try
     {
         var x = Database.GetVideos(status);
         return(x);
     }
     catch (Exception ex)
     { throw; }
 }
コード例 #10
0
ファイル: Video.cs プロジェクト: vanyok1991/tubesave
        public bool TrySetFinishedStatus()
        {
            if (Status == VideoStatus.InProgress)
            {
                Status = VideoStatus.Finished;
                return(true);
            }

            return(false);
        }
コード例 #11
0
ファイル: Video.cs プロジェクト: vanyok1991/tubesave
        public bool TrySetInProgressStatus()
        {
            if (Status == VideoStatus.Open)
            {
                Status = VideoStatus.InProgress;

                return(true);
            }

            return(false);
        }
コード例 #12
0
        void OnUpdateStatus(object sender, EventArgs args)
        {
            VideoStatus status = VideoStatus.NotReady;

            if (isPrepared)
            {
                status = videoView.IsPlaying ? VideoStatus.Playing : VideoStatus.Paused;
            }

            ((IVideoPlayerController)Element).status = status;
        }
コード例 #13
0
            protected internal void SetData(VideoStatus video, int position)
            {
                VideoTitle.Text = video.Title;
                Glide.With(Application.Context).Load(video.CoverPath).Placeholder(Application.Context.GetDrawable(Resource.Drawable.video)).Into(CoverImage);

                if (position > lastPosition)
                {
                    ItemView.StartAnimation(AnimationUtils.LoadAnimation(Application.Context, Resource.Animation.item_anim_slide_from_right));
                    lastPosition = position;
                }
            }
コード例 #14
0
        public int AddVideo(string Title, VideoStatus Status, string Object, string Description, int?CategoryId,
                            int?CreatorId, string Image, bool?AutoResize, Languages?lan)
        {
            int videoID = AddVideo(Title, Status, Object, Description, CategoryId,
                                   CreatorId, null, AutoResize, lan, null);


            WebClient webClient = new WebClient();
            string    ImageName = Path.GetFileNameWithoutExtension(Image);

            ImageName = string.Format("{0}_{1}{2}", ImageName, videoID, Path.GetExtension(Image));


            string path = WebContext.Server.MapPath("~/" + Folders.VideoThumbsFolder);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            path = Path.Combine(path, ImageName);

            webClient.DownloadFile(Image, path);

            if (AutoResize != null && AutoResize.Value == true)
            {
                VideoCategory cat = GetVideoCategory(CategoryId.Value);
                if (cat.ThumbWidth > 0 && cat.ThumbHeight > 0)
                {
                    //ImageUtils.Resize(path, path, (int)cat.ThumbWidth, (int)cat.ThumbHeight);
                    ImageUtils.CropImage(path, path, (int)cat.ThumbWidth, (int)cat.ThumbHeight, ImageUtils.AnchorPosition.Default);
                }
                else
                {
                    Config    cfg = new Config();
                    Dimension dim = new Dimension(cfg.GetKey(lw.CTE.parameters.VideoThumbSize));

                    if (dim.Width > 0 && dim.Height > 0)
                    {
                        ImageUtils.CropImage(path, path, (int)dim.Width, (int)dim.Height, ImageUtils.AnchorPosition.Default);
                    }
                }
            }
            Video thisVideo = this.GetVideo(videoID);

            thisVideo.ThumbImage = ImageName;

            MediaData.SubmitChanges();
            return(videoID);
        }
コード例 #15
0
        private IEnumerable <ListViewItem> GetAvailableVideos(VideoStatus videoStatus)
        {
            var s = from v in booking.GetVideos(videoStatus)
                    join g in booking.GetGenres() on v.Value.GenreId equals g.Value.Id
                    select
                    new ListViewItem(new string[]
            {
                v.Value.Name,
                g.Value.Name,
                v.Value.RentalDays.ToString(),
                v.Value.Id.ToString()
            });

            return(s);
        }
コード例 #16
0
        // Event handler to update status
        void OnUpdateStatus(object sender, EventArgs args)
        {
            VideoStatus status = VideoStatus.NotReady;

            if (isPrepared)
            {
                //   status = videoView.IsPlaying ? VideoStatus.Playing : VideoStatus.Paused;
            }

            ((IVideoPlayerController)Element).Status = status;

            // Set Position property
            //  TimeSpan timeSpan = TimeSpan.FromMilliseconds(videoView.CurrentPosition);
            //  ((IElementController)Element).SetValueFromRenderer(VideoPlayer.PositionProperty, timeSpan);
        }
コード例 #17
0
        public ActionResult UpdateVideoStatus(int id, VideoStatus status)
        {
            Video vid = db.Videos.Find(id);

            if (vid != null)
            {
                vid.Status          = status;
                db.Entry(vid).State = EntityState.Modified;
                db.SaveChanges();

                return(Json(new { Success = true }));
            }

            return(Json(new { Error = "Error no video Q found" }));
        }
コード例 #18
0
        public HttpResponseMessage videoOff(string numbers)// 提供关闭摄像头,清除本地配置文件的接口
        {
            VideoStatus          video_Infos = new VideoStatus();
            JavaScriptSerializer serializer  = new JavaScriptSerializer();

            string json = string.Empty;

            string[] num_List = numbers.Split(',');

            // 传递数据参数合法性判断,是否有非英文","字符
            foreach (string item in num_List)
            {
                if (!int.TryParse(item, out _)) //解析成功是数字则返回true,否则返回false
                {
                    video_Infos.code = "-1";
                    video_Infos.msg  = "Error, Invalid parameter";
                    json             = serializer.Serialize(video_Infos);
                    return(new HttpResponseMessage {
                        Content = new StringContent(json, Encoding.GetEncoding("UTF-8"), "application/json")
                    });
                }
            }

            // 参数合法的时候进行删除
            string status = Add_Del_Json.instance().DeleteJson(numbers) ? "0" : "-1";// 双目表达式

            if (status == "0")
            {
                video_Infos.code = "0";
                video_Infos.msg  = "Success";
                json             = serializer.Serialize(video_Infos);
                return(new HttpResponseMessage {
                    Content = new StringContent(json, Encoding.GetEncoding("UTF-8"), "application/json")
                });
            }
            else
            {
                video_Infos.code = "-1";
                video_Infos.msg  = "Local configuration file path error";
                json             = serializer.Serialize(video_Infos);
                return(new HttpResponseMessage {
                    Content = new StringContent(json, Encoding.GetEncoding("UTF-8"), "application/json")
                });
            }
        }//end_videoOff
コード例 #19
0
        void OnMediaElementCurrentStateChanged(object sender, RoutedEventArgs args)
        {
            VideoStatus videoStatus = VideoStatus.NotReady;

            switch (Control.CurrentState)
            {
            case MediaElementState.Playing:
                videoStatus = VideoStatus.Playing;
                break;

            case MediaElementState.Paused:
            case MediaElementState.Stopped:
                videoStatus = VideoStatus.Paused;
                break;
            }

            ((IVideoPlayerController)Element).Status = videoStatus;
        }
コード例 #20
0
ファイル: StreamHub.cs プロジェクト: m-lima/SyncTube
        public void CreateOrJoinRoom(string roomId)
        {
            if (!RoomStatuses.ContainsKey(roomId))
            {
                RoomStatuses[roomId] = new VideoStatus();
            }

            if (_roomLoopThread == null)
            {
                _roomLoopThread = new Thread(LoopRooms);
                _roomLoopThread.Start();
            }

            RoomStatuses[roomId].UserList.Add(Context.ConnectionId);
            _logger.LogInformation(Context.User.Identity.Name + " has joined stream room [" + roomId + ']');
            _logger.LogInformation(RoomStatuses[roomId].UserList.Count + " users connected to room [" + roomId + ']');
            Groups.Add(Context.ConnectionId, roomId);
        }
コード例 #21
0
        private IEnumerable <ListViewItem> GetBookedVideos(VideoStatus videoStatus)
        {
            var s = from v in booking.GetVideos(videoStatus)
                    join b in booking.GetBookings() on v.Value.Id equals b.Value.VideoId
                    join g in booking.GetGenres() on v.Value.GenreId equals g.Value.Id
                    join c in booking.GetCustomers() on b.Value.CustomerId equals c.Value.Id
                    select
                    new ListViewItem(new ListViewBooking
            {
                BookingId  = b.Value.Id,
                CustomerId = c.Value.Id,
                Customer   = String.Format("{0} {1}", c.Value.LastName, c.Value.FirstName),
                Title      = v.Value.Name,
                Genre      = g.Value.Name,
                Rented     = b.Value.Rented,
                Returned   = b.Value.Returned,
                Cost       = b.Value.Cost
            }.ToArray());

            return(s);
        }
コード例 #22
0
ファイル: Database.cs プロジェクト: esi1/DotNet
        public Dictionary <int, IVideo> GetVideos(VideoStatus status)
        {
            switch (status)
            {
            case VideoStatus.All:
                return(TestData.vidoes);

            case VideoStatus.Booked:
                return((from c in TestData.vidoes
                        join b in TestData.videoBookings on c.Value.Id equals b.Value.VideoId
                        where c.Value.IsRented.Equals(true)
                        select c).Distinct().ToDictionary(x => x.Key, x => x.Value));

            case VideoStatus.Available:
                return((from c in TestData.vidoes
                        where GetVideos(VideoStatus.Booked)
                        .Count(b => b.Value.Id.Equals(c.Value.Id)).Equals(0)
                        select c).ToDictionary(x => x.Key, x => x.Value));
            }
            return(TestData.vidoes);
        }
コード例 #23
0
ファイル: VideoStatuses.cs プロジェクト: m-lima/SyncTube
 public VideoStatusLightweight(string roomId, VideoStatus status)
 {
     RoomId = roomId;
     Time = status.Time;
     UserCount = status.UserList.Count;
     switch (status.Status)
     {
         case Status.Playing:
             CurrentStatus = "play";
             break;
         case Status.Paused:
             CurrentStatus = "pause";
             break;
         case Status.Ended:
             CurrentStatus = "end";
             break;
         default:
             CurrentStatus = "unstarted";
             break;
     }
 }
コード例 #24
0
        void OnMediaElementCurrentStateChanged(MediaPlayer sender, object args)
        {
            VideoStatus videoStatus = VideoStatus.NotReady;

            switch (sender.PlaybackSession.PlaybackState)
            {
            case MediaPlaybackState.Playing:
                videoStatus = VideoStatus.Playing;
                break;

            case MediaPlaybackState.Paused:
                videoStatus = VideoStatus.Paused;
                break;

            case MediaPlaybackState.None:
                // Same as Stopped Status in deprecated(MediaElement)
                videoStatus = VideoStatus.NotReady;
                break;
            }

            ((IVideoPlayerController)Element).Status = videoStatus;
        }
コード例 #25
0
        // Event handler to update status
        void OnUpdateStatus(object sender, EventArgs args)
        {
            VideoStatus status = VideoStatus.NotReady;

            if (isPrepared)
            {
                status = videoView.IsPlaying ? VideoStatus.Playing : VideoStatus.Paused;
            }

            ((IVideoPlayerController)Element).Status = status;

            // Set Position property
            TimeSpan timeSpan = TimeSpan.FromMilliseconds(videoView.CurrentPosition);

            ((IElementController)Element).SetValueFromRenderer(VideoPlayer.PositionProperty, timeSpan);

            //reset Position to zero when video played if Autoloop is true
            if (Element.AutoLoop && Element.Status == VideoStatus.Paused && (!pausedMannully))
            {
                //SetSource();
                Element.Play();
            }
        }
コード例 #26
0
        public bool UpdateVideoStatus(int id, VideoStatus status)
        {
            var client = new RestClient(APIPath);

            client.AddDefaultHeader("api-key", ApiKey);
            var request = new RestRequest("updatevideostatus", Method.POST);

            request.AddParameter("id", id);
            request.AddParameter("status", status);

            var response = client.Execute(request);

            if (response != null && response.Content != null)
            {
                if (response.Content == "{\"Success\":true}")
                {
                    return(true);
                }
                Library.WriteErrorLog("Error Getting Video Q Status.");
                Library.WriteErrorLog(response.StatusCode.ToString());
                Library.WriteErrorLog(response.Content);
            }
            return(false);
        }
コード例 #27
0
        public int AddVideo(string Title, VideoStatus Status, string Object, string Description, int?CategoryId,
                            int?CreatorId, HttpPostedFile Image, bool?AutoResize, Languages?lan, HttpPostedFile VideoFile)
        {
            if (StringUtils.IsNullOrWhiteSpace(Title))
            {
                return(-1);
            }

            if (lan == null)
            {
                lan = Languages.Default;
            }

            Video video = new Video
            {
                Title        = Title,
                Status       = (byte)Status,
                Object       = Object,
                Description  = Description,
                CategoryId   = CategoryId,
                CreatorId    = CreatorId.Value,
                DateCreated  = DateTime.Now,
                DateModified = DateTime.Now,
                UniqueName   = StringUtils.ToURL(Title),
                ModifierId   = CreatorId,
                Language     = (short)lan
            };

            MediaData.Videos.InsertOnSubmit(video);
            MediaData.SubmitChanges();

            bool generateThumb = Image != null && Image.ContentLength > 0;


            if (VideoFile != null && VideoFile.ContentLength > 0)
            {
                string videoName = Path.GetFileNameWithoutExtension(VideoFile.FileName);
                videoName = string.Format("{0}_{1}{2}", videoName, video.VideoId,
                                          Path.GetExtension(VideoFile.FileName));


                string path = WebContext.Server.MapPath("~/" + Folders.VideosFolder);

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                path = Path.Combine(path, videoName);

                VideoFile.SaveAs(path);


                //ShellFile so = ShellFile.FromFilePath(path);


                //decimal nanoseconds;
                //decimal.TryParse(so.Properties.System.Media.Duration.Value.ToString(), out nanoseconds);

                //decimal seconds = nanoseconds * (decimal)0.0000001;

                //video.VideoLength = seconds;

                //if (!generateThumb)
                //{
                //    string imageName = Path.GetFileNameWithoutExtension(videoName) + ".Jpg";

                //    string thumbImagePath = WebContext.Server.MapPath("~/" + Folders.VideoThumbsFolder);

                //    if (!Directory.Exists(thumbImagePath))
                //    {
                //        Directory.CreateDirectory(thumbImagePath);
                //    }

                //    string imagePath = Path.Combine(thumbImagePath, imageName);

                //    //so.Thumbnail.Bitmap.Save (imagePath);
                //    System.Drawing.Bitmap image;

                //    //force the actual thumbnail, not the icon

                //    //so.Thumbnail.FormatOption = ShellThumbnailFormatOptions.ThumbnailOnly;

                //    //image = so.Thumbnail.ExtraLargeBitmap;
                //    image.Save(imagePath);

                //    VideoCategory cat = GetVideoCategory(CategoryId.Value);
                //    if (cat.ThumbWidth > 0 && cat.ThumbHeight > 0)
                //    {
                //        ImageUtils.CropImage(imagePath, imagePath, (int)cat.ThumbWidth, (int)cat.ThumbHeight, ImageUtils.AnchorPosition.Default);
                //    }
                //    else
                //    {
                //        Config cfg = new Config();
                //        Dimension dim = new Dimension(cfg.GetKey(lw.CTE.parameters.VideoThumbSize));

                //        if (dim.Width > 0 && dim.Height > 0)
                //        {
                //            ImageUtils.CropImage(imagePath, imagePath, (int)dim.Width, (int)dim.Height, ImageUtils.AnchorPosition.Default);
                //        }
                //    }
                //    video.ThumbImage = imageName;
                //}

                video.VideoFile = videoName;

                MediaData.SubmitChanges();
            }


            if (Image != null && Image.ContentLength > 0)
            {
                string ImageName = Path.GetFileNameWithoutExtension(Image.FileName);
                ImageName = string.Format("{0}_{1}{2}", ImageName, video.VideoId,
                                          Path.GetExtension(Image.FileName));


                string path = WebContext.Server.MapPath("~/" + Folders.VideoThumbsFolder);

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                path = Path.Combine(path, ImageName);

                Image.SaveAs(path);

                if (AutoResize != null && AutoResize.Value == true)
                {
                    VideoCategory cat = GetVideoCategory(CategoryId.Value);
                    if (cat.ThumbWidth > 0 && cat.ThumbHeight > 0)
                    {
                        //ImageUtils.Resize(path, path, (int)cat.ThumbWidth, (int)cat.ThumbHeight);
                        ImageUtils.CropImage(path, path, (int)cat.ThumbWidth, (int)cat.ThumbHeight, ImageUtils.AnchorPosition.Default);
                    }
                    else
                    {
                        Config    cfg = new Config();
                        Dimension dim = new Dimension(cfg.GetKey(lw.CTE.parameters.VideoThumbSize));

                        if (dim.Width > 0 && dim.Height > 0)
                        {
                            ImageUtils.CropImage(path, path, (int)dim.Width, (int)dim.Height, ImageUtils.AnchorPosition.Default);
                        }
                    }
                }

                video.ThumbImage = ImageName;

                MediaData.SubmitChanges();
            }
            return(video.VideoId);
        }
コード例 #28
0
 public VideoProgress(long progress, long total, VideoStatus status)
 {
     Progress = progress;
     Total    = total;
     Status   = status;
 }
コード例 #29
0
            static void UploadVideos()
            {
                Console.WriteLine("User Menu - Por favor Introduce tu Password de 4 dígitos, para salir - s");
                var option = Console.ReadLine();

                if (option == "s")
                {
                    MainMenu();
                }

                while (String.IsNullOrEmpty(option))
                {
                    Console.WriteLine("Campo vacío, por favor elije una las opciones arriba.");
                    option = Console.ReadLine();
                }
                int value;
                var pass = Int32.TryParse(option, out value);

                if (option == "s")
                {
                    MainMenu();
                }

                foreach (var user in Users)
                {
                    if (user.Pass == value)
                    {
                        Console.WriteLine($"Hola {user.Name}");

                        Console.WriteLine("Opción: s - para salir");
                        Console.WriteLine("Opción: a - adicionar videos ");
                        Console.WriteLine("Opción: v - ver lista");
                        Console.WriteLine("Opción: t - Tag your videos");
                        Console.WriteLine("Opción: r - Reproducción");

                        while (true)
                        {
                            var handleAction = Console.ReadLine();
                            if (handleAction == "s")
                            {
                                break;
                            }



                            else if (handleAction == "a")
                            {
                                Console.WriteLine("Para salir - s.");
                                Console.WriteLine("Escribe el título del vídeo:");


                                var title = Console.ReadLine();

                                if (title == "s")
                                {
                                    break;
                                }

                                while (String.IsNullOrEmpty(title))
                                {
                                    Console.WriteLine("Campo vacío, por favor elije una las opciones arriba.");
                                    title = Console.ReadLine();
                                }

                                var myVideo = new Video
                                {
                                    Title = title
                                };

                                user.AddVideos(myVideo);
                                Console.WriteLine("Tag your video. Para salir - s ");

                                var i = 0;
                                while (true)
                                {
                                    var tagVideo = Console.ReadLine();
                                    if (tagVideo == "s")
                                    {
                                        break;
                                    }
                                    else
                                    {
                                        myVideo.AddTags(tagVideo);
                                    }

                                    i++;
                                }


                                foreach (var tag in myVideo.Tags)
                                {
                                    Console.WriteLine($"Tags: \n {tag}");
                                }

                                Console.WriteLine("Opción: s - Para salir");
                                Console.WriteLine("Opción: a - Adicionar videos ");
                                Console.WriteLine("Opción: v - Ver lista");
                                Console.WriteLine("Opción: t - Tag your videos");
                                Console.WriteLine("Opción: r - Reproducción");
                            }

                            else if (handleAction == "v")
                            {
                                foreach (var v in user.MyVideos)
                                {
                                    Console.WriteLine($"Video Title: {v.Title} \n Video Url: {v.Url}");
                                }
                            }


                            else if (handleAction == "r")
                            {
                                foreach (var p in user.MyVideos)
                                {
                                    Console.WriteLine($"Video Title: {p.Title}");
                                }

                                Console.WriteLine("Elije video para reproducir escribiendo el título.");

                                var videoToPlay = Console.ReadLine();

                                user.MyVideos.Select(videoToPlay => videoToPlay.Title);
                                Console.WriteLine(videoToPlay);



                                Console.WriteLine("Opción: r - Reproducir video");
                                Console.WriteLine("Opción: p - Pausar videos ");
                                Console.WriteLine("Opción: s - Parar video");
                                var statusVideo = Console.ReadLine();

                                while (true)
                                {
                                    if (statusVideo == "r")
                                    {
                                        VideoStatus play = VideoStatus.Playing;
                                        Console.WriteLine($"{videoToPlay} is {play}");
                                        Console.WriteLine("Opción: p - Pausar videos ");
                                        Console.WriteLine("Opción: s - Parar video");
                                        statusVideo = Console.ReadLine();
                                    }
                                    else if (statusVideo == "p")
                                    {
                                        VideoStatus pause = VideoStatus.Paused;
                                        Console.WriteLine($"{videoToPlay} is {pause}");
                                        Console.WriteLine("Opción: r - Reproducir video");
                                        Console.WriteLine("Opción: s - Parar video");
                                        Console.WriteLine("Opción: e - Parar salir");
                                        statusVideo = Console.ReadLine();
                                    }
                                    else if (statusVideo == "s")
                                    {
                                        VideoStatus stop = VideoStatus.Stopped;
                                        Console.WriteLine($"{videoToPlay} is {stop}");
                                        Console.WriteLine("Opción: r - Reproducir video");
                                        Console.WriteLine("Opción: e - Parar salir");
                                        statusVideo = Console.ReadLine();
                                    }
                                    else
                                    {
                                        break;
                                    }

                                    Console.WriteLine("Opción: s - Para salir");
                                    Console.WriteLine("Opcion: a - Adicionar videos ");
                                    Console.WriteLine("Opción: v - Ver lista");
                                    Console.WriteLine("Opción: t - Tag your videos");
                                    Console.WriteLine("Opción: r - Leproducción");
                                }
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("Usuario no encontrado");
                        MainMenu();
                    }
                }
            }
コード例 #30
0
        public HttpResponseMessage videoOn(string numbers)// 提供关闭摄像头,清除本地配置文件的接口
        {
            VideoStatus          video_Infos = new VideoStatus();
            JavaScriptSerializer serializer  = new JavaScriptSerializer();

            string json = string.Empty;

            string[] num_List = numbers.Split(',');

            // 传递数据参数合法性判断,是否有非英文","字符
            foreach (string item in num_List)
            {
                if (!int.TryParse(item, out _)) //解析成功是数字则返回true,否则返回false
                {
                    video_Infos.code = "-1";
                    video_Infos.msg  = "Error, Invalid parameter";
                    json             = serializer.Serialize(video_Infos);
                    return(new HttpResponseMessage {
                        Content = new StringContent(json, Encoding.GetEncoding("UTF-8"), "application/json")
                    });
                }
            }

            // 参数合法的时候进行添加
            string status = Add_Del_Json.instance().AddJson(numbers);

            switch (status)
            {
            case "0":
            {
                video_Infos.code = "0";
                video_Infos.msg  = "Success";
            }
            break;

            case "1":
            {
                video_Infos.code = "1";
                video_Infos.msg  = "More than maxCount, Reject Post request";
            }
            break;

            case "-1":
            {
                video_Infos.code = "-1";
                video_Infos.msg  = "Local configuration file path error";
            }
            break;

            case "-2":
            {
                video_Infos.code = "-2";
                video_Infos.msg  = "Remote config file is null or has errors";
            }
            break;

            default:
                break;
            }
            json = serializer.Serialize(video_Infos);
            return(new HttpResponseMessage {
                Content = new StringContent(json, Encoding.GetEncoding("UTF-8"), "application/json")
            });
        } //end_videoOn
コード例 #31
0
        /// <summary>
        /// Retrieve videos and/or streams from the HoloTools database.
        /// </summary>
        /// <remarks>Timestamped comments are not returned in a bulk search, and will always be empty.</remarks>
        /// <param name="limit">The limit of videos to retrieve. Must be less than or equal to 50.</param>
        /// <param name="offset">How many results to offset by.</param>
        /// <param name="startDate">Only retrieve videos after the given <see cref="DateTime"/></param>
        /// <param name="endDate">Only retrieve videos before the given <see cref="DateTime"/></param>
        /// <param name="type">The specific <see cref="VideoStatus"/> to retrieve.</param>
        /// <param name="isUploaded">When true, only return uploaded videos and not streams.</param>
        /// <param name="isCaptioned">When true, only return videos with closed captions.</param>
        /// <returns>A ReadOnlyCollection of retrieved videos.</returns>
        public IReadOnlyCollection <Video> GetVideos(int limit       = 25, int offset = 0, DateTime?startDate = null, DateTime?endDate = null, VideoStatus status = VideoStatus.ANY,
                                                     bool isUploaded = false, bool isCaptioned = false)
        {
            char uploaded  = isUploaded ? '1' : '0';
            char captioned = isCaptioned ? '1' : '0';

            if (limit > 50)
            {
                limit = 50;
            }
            if (limit < 0)
            {
                limit = 0;
            }
            StringBuilder build = new StringBuilder($"videos?limit={limit}&offset={offset}");

            if (startDate.HasValue)
            {
                build.Append($"&start_date={startDate.Value:yyyy-MM-dd}");
            }
            if (endDate.HasValue)
            {
                build.Append($"&end_date={endDate.Value:yyyy-MM-dd}");
            }
            if (status != VideoStatus.ANY)
            {
                build.Append($"&status={status.ToString().ToLower()}");
            }
            build.Append($"&is_uploaded={uploaded}&is_captioned={captioned}");
            List <Video> videos = new List <Video>();
            JObject      vids   = SendRequest(build.ToString());

            foreach (JToken t in vids["videos"])
            {
                videos.Add(t.ToObject <Video>());
            }
            return(videos);
        }
コード例 #32
0
 public void CambiarEstado(VideoStatus NuevoEstado)
 {
     this.Estado = NuevoEstado;
 }