void Load()
        {
            if (CaptureDeviceConfiguration.AllowedDeviceAccess ||
                            CaptureDeviceConfiguration.RequestDeviceAccess())
            {
                var devices = CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices();

                foreach (var device in devices)
                {
                    var videoItem = new VideoItem();
                    videoItem.Name = device.FriendlyName;

                    var source = new CaptureSource();
                    source.VideoCaptureDevice = device;
                    var videoBrush = new VideoBrush();
                    videoBrush.SetSource(source);
                    videoItem.Brush = videoBrush;
                    this.sources.Add(source);
                    this.sourceItems.Add(videoItem);
                }

                this.videoItems.ItemsSource = this.sourceItems;
                this.StartAll();
            }
        }
Example #2
0
 public HttpResponseMessage AddShare(VideoItem videoCounters)
 {
     //Connect to the Umbraco DB
     var db = ApplicationContext.DatabaseContext.Database;
     var result = db.Update<VideoItem>("SET Likes = @0 WHERE VideoId = @1", videoCounters.Shares + 1, videoCounters.VideoId);
     return (result == 1) ? Request.CreateResponse(HttpStatusCode.OK) : Request.CreateResponse(HttpStatusCode.InternalServerError);
 }
 public bool AddVideoItem(VideoItem item)
 {        
     foreach (var vid in VidListItems)
         if (vid.Equals(item))
             return false;
     VidListItems.Add(item);
     VideoList.ItemsSource = VidListItems;
     return true;
 }
        public GenericListItemCollections GetList(SiteItemEntry entry)
        {
            GenericListItemCollections res = new GenericListItemCollections();
              res.Title = entry.Title;
              User user = new User(Youtube2MP._settings.LastFmUser, Youtube2MP.LastFmProfile.Session);
              switch (entry.GetValue("type"))
              {
            case "TopTracks":
              {
            TopTrack[] tracks = user.GetTopTracks();
            //user.GetRecentTracks()
            foreach (TopTrack topTrack in tracks)
            {
              SiteItemEntry newentry = new SiteItemEntry();
              VideoItem videoItem = new VideoItem();
              newentry.Provider = videoItem.Name;
              newentry.Title = topTrack.Item.ToString();
              res.Items.Add(new GenericListItem()
              {
                IsFolder = false,
                Title = newentry.Title,
                Tag = newentry,
                LogoUrl = ArtistManager.Instance.GetArtistsImgUrl(topTrack.Item.Artist.Name),
                DefaultImage = "defaultArtistBig.png"
              });
            }
              }
              break;
            case "RecentTracks":
              {
            Track[] tracks = user.GetRecentTracks(40);
            //user.GetRecentTracks()
            foreach (Track topTrack in tracks)
            {
              SiteItemEntry newentry = new SiteItemEntry();
              VideoItem videoItem = new VideoItem();
              newentry.Provider = videoItem.Name;
              newentry.Title = topTrack.ToString();
              res.Items.Add(new GenericListItem()
              {
                IsFolder = false,
                Title = newentry.Title,
                Tag = newentry,
                LogoUrl = ArtistManager.Instance.GetArtistsImgUrl(topTrack.Artist.Name),
                DefaultImage = "defaultArtistBig.png"

              });
            }
              }
              break;
              }
              res.ItemType = ItemType.Video;
              return res;
        }
Example #5
0
 public WatchPage(string parent, VideoItem item, ApiHandler api)
 {
     InitializeComponent();
     BindingContext     = this;
     apiHandler         = api;
     parentPage         = parent;
     this.item          = item;
     Title              = item.Title;
     TitleLabel.Text    = item.Title;
     DurationLabel.Text = item.Duration;
     GetDownloadableLinks();
 }
Example #6
0
        public void PrevNextFromMiddleItemAllowed()
        {
            Schedule schedule = new ScheduleBuilder()
                                .WithItems(ImageItem.Build(), VideoItem.Build(), ImageItem.Build())
                                .Build();
            SchedulePageViewModel model = CreateViewModel(schedule);

            // move to middle
            model.NextCommand.Execute(null);

            Assert.True(model.PreviousCommand.CanExecute(null));
            Assert.True(model.NextCommand.CanExecute(null));
        }
Example #7
0
        public Task <HistoryItem> AddAsync([NotNull] VideoItem videoItem, [NotNull] PartyTubeDbContext context)
        {
            if (videoItem == null)
            {
                throw new ArgumentNullException(nameof(videoItem));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            return(AddPrivateAsync(videoItem, context, false));
        }
Example #8
0
        /// <inheritdoc/>
        public async Task <VideoItem> AddVideoItemAsync(VideoItem video)
        {
            if (video.Id > 0)
            {
                throw new ArgumentException($"{nameof(video)} has id greater than 0");
            }

            await this.Videos.AddAsync(video);

            await this.SaveChangesAsync();

            return(video);
        }
Example #9
0
        private void OpenNetworkFile(string path)
        {
            VideoItem item = new VideoItem();

            if (!(path.StartsWith("https") || path.StartsWith("http") || path.StartsWith("ftp")))
            {
                path = "http://" + path;
            }
            item.Path = path;
            item.Type = 1;
            item.Name = PlayerHelper.GetVideoName(path, item.Type);
            Open(item);
        }
Example #10
0
        private async Task <bool> SaveMoviePictureAsync(VideoItem video, byte[] img)
        {
            if (await FetcherHelpers.SaveBytes(video.Id, "moviePic", img, "jpg", false))
            {
                await DispatchHelper.InvokeInUIThread(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    video.HasMoviePicture = true;
                });

                return(true);
            }
            return(false);
        }
 // Check whether there are new thumbnails to download. If so, start downloading just one.
 private void CheckQueue()
 {
     if (isBusy)     // Stop! Downloading in progress...
     {
         return;
     }
     if (downloadQueue.Count > 0)
     {
         isBusy = true;
         VideoItem item = downloadQueue.Peek();
         thumbnailDownloader.OpenReadAsync(new Uri(item.Url));
     }
 }
Example #12
0
 //根据拓展格式,判断是否支持此文件类型
 public static bool isRightExt(VideoItem item)
 {
     string[] strArray = new string[] { ".avi", ".mp4", ".rm", ".mkv", ".wmv", ".rmvb", ".flv", ".mov", ".mpg", ".divx", ".xvid" };
     foreach (string str in strArray)
     {
         //找到此拓展格式
         if (item.Ext.ToLower() == str)
         {
             return(true);
         }
     }
     return(false);
 }
Example #13
0
        public void NonRecordingVideoHasAutoPlay()
        {
            ScheduleItem item = VideoItem
                                .WithRecordingEnabled(false)
                                .Build();

            ScheduleItemViewModel model = new ScheduleItemViewModel(item, mockRepo.Object)
            {
                ItemDisplayState = ScheduleItemStateType.Start
            };

            Assert.True(model.VideoPlay);
        }
        /// <summary>
        /// Navigates to the Video Player screen with the requested file a parameter.
        /// </summary>
        /// <param name="file">The file to be played.</param>
        /// <param name="token">Token is for files that are NOT in the sandbox, such as files taken from the filepicker from a sd card but not in the Video/Music folder.</param>
        public async Task PlayVideoFile(StorageFile file, string token = null)
        {
            Locator.NavigationService.Go(VLCPage.VideoPlayerPage);
            VideoItem videoVm = new VideoItem();
            await videoVm.Initialize(file);

            if (token != null)
            {
                videoVm.Token = token;
            }
            Locator.VideoVm.CurrentVideo = videoVm;
            await PlaylistHelper.Play(videoVm);
        }
        public void YouTubeUrl_ShouldHave_RightMaxValueFor_RequiredAttribute()
        {
            var obj = new VideoItem();

            var result = obj.GetType()
                         .GetProperty("YouTubeUrl")
                         .GetCustomAttributes(false)
                         .Where(x => x.GetType() == typeof(MaxLengthAttribute))
                         .Select(x => (MaxLengthAttribute)x)
                         .SingleOrDefault();

            Assert.IsNotNull(result);
            Assert.AreEqual(ValidationConstants.UrlLengthMaxValue, result.Length);
        }
Example #16
0
        public async Task NavigateToPlayerPage(VideoItem item)
        {
            var parameters = new NavigationParameters();

            parameters.Add(NavigationParameterNames.VideoPath, item.FilePath);
            if (backToTrimmer)
            {
                await navigationService.GoBackAsync(parameters);
            }
            else
            {
                await navigationService.NavigateAsync(PageNames.Player, parameters);
            }
        }
Example #17
0
        private void OpenLocalFile(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            VideoItem item = new VideoItem();

            item.Path = path;
            item.Type = 0;
            item.Name = PlayerHelper.GetVideoName(path, item.Type);
            Open(item);
        }
Example #18
0
        private void Open(VideoItem item)
        {
            if (item.Type == 0 && System.IO.File.Exists(item.Path) == false)
            {
                MessageBox.Show("文件不存在");
                return;
            }

            CurrentVideoItem = item;

            this.player.Open(item.Path);
            this.player.Play();
            EnablePlayerProgress();
        }
Example #19
0
    private void OnPlayResponse(string obj)
    {
        Message m = JsonUtility.FromJson <Message>(obj);

        isPlay = true;
        playAndPause.GetComponentInChildren <Text>().text = "Pause";
        if (null != m)
        {
            VideoItem i = JsonUtility.FromJson <VideoItem>(m.cmdContext);
            message.text = $"生在播放 :{i.name}\n文件备注 :{ i.description}";
        }
        else
        {
            message.text = $"播放失败 !";
        }
    }
Example #20
0
        public void VideoResetInvokedOnChangeToStart()
        {
            ScheduleItem item = VideoItem
                                .WithRecordingEnabled(true)
                                .Build();

            ScheduleItemViewModel model = new ScheduleItemViewModel(item, mockRepo.Object);

            model.ItemDisplayState = ScheduleItemStateType.Finish;

            Assert.Raises <EventArgs>(
                attach: handler => model.VideoReset   += handler,
                detach: handler => model.VideoReset   -= handler,
                testCode: () => model.ItemDisplayState = ScheduleItemStateType.Start
                );
        }
        private async Task <bool> SaveMoviePictureAsync(VideoItem video, byte[] img)
        {
            if (await FetcherHelpers.SaveBytes(video.Id, "moviePic", img, "jpg", false))
            {
                await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    // Thumbnail is only refreshed when IsPictureLoaded changes, so first we set HasMoviePicture,
                    // then IsPictureLoaded
                    video.HasMoviePicture = true;
                    video.IsPictureLoaded = true;
                });

                return(true);
            }
            return(false);
        }
        public async Task <ActionResult <VideoItem> > CreateVideoItem(VideoItemDTO videoItemDTO)
        {
            var videoItem = new VideoItem
            {
                IsComplete = videoItemDTO.IsComplete,
                Name       = videoItemDTO.Name
            };

            _context.VideoItems.Add(videoItem);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(
                       nameof(GetVideoItem),
                       new { id = videoItem.Id },
                       ItemToDTO(videoItem)));
        }
Example #23
0
        public void Creates_VideoAppDirective()
        {
            var videoItem = new VideoItem("https://www.example.com/video/sample-video-1.mp4")
            {
                Metadata = new VideoItemMetadata
                {
                    Title    = "Title for Sample Video",
                    Subtitle = "Secondary Title for Sample Video"
                }
            };
            var actual = new VideoAppDirective {
                VideoItem = videoItem
            };

            Assert.True(Utility.CompareJson(actual, "VideoAppDirectiveWithMetadata.json"));
        }
Example #24
0
        private async Task <HistoryItem> AddPrivateAsync([NotNull] VideoItem videoItem,
                                                         [NotNull] PartyTubeDbContext context,
                                                         bool isSave)
        {
            videoItem = await _videoRepository.GetAttachedOfFoundedAsync(videoItem, context).ConfigureAwait(false);

            var historyItem = new HistoryItem(videoItem);
            await context.History.AddAsync(historyItem).ConfigureAwait(false);

            if (isSave)
            {
                await context.SaveChangesAsync().ConfigureAwait(false);
            }

            return(historyItem);
        }
Example #25
0
        public async Task GetAttachedOfFoundedAsync_Should_Find()
        {
            var context  = _context.Context;
            var fixture  = new Fixture();
            var expected = fixture.Build <VideoItem>().Without(item => item.PlaylistVideoItems).Create();
            await context.Video.AddAsync(expected).ConfigureAwait(false);

            await context.SaveChangesAsync().ConfigureAwait(false);

            var videoItem = new VideoItem {
                VideoIdentifier = expected.VideoIdentifier
            };
            var actual = await _videoRepository.GetAttachedOfFoundedAsync(videoItem, context).ConfigureAwait(false);

            actual.Should().BeEquivalentTo(expected);
        }
Example #26
0
        async Task UpdateCurrentVideo(VideoItem video)
        {
            await DispatchHelper.InvokeInUIThread(CoreDispatcherPriority.Normal, () =>
            {
                Locator.VideoPlayerVm.CurrentVideo = video;
                if (video != null)
                {
                    AppViewHelper.SetTitleBarTitle(video.Name);
                }
            });

            if (video != null)
            {
                await TryUseSubtitleFromFolder();
            }
        }
Example #27
0
    public void IniRecommendContent()
    {
        RecommendConntent = UISettingManager.GetUITransform("RecommendConntent");
        dataItem          = UISettingManager.GetUITransform("DataItem");
        dataItem.Find("name").GetComponent <Text>().text = JsonDataManager.leftRecoItem.title;
        dataItem.name = JsonDataManager.leftRecoItem.contentId;
        ////把该item添加进去字典里
        VideoItem leftItems = new VideoItem();

        leftItems.contentId  = JsonDataManager.leftRecoItem.contentId;
        leftItems.title      = JsonDataManager.leftRecoItem.title;
        leftItems.subscript  = JsonDataManager.leftRecoItem.subscript;
        leftItems.clickType  = JsonDataManager.leftRecoItem.clickType;
        leftItems.clickParam = JsonDataManager.leftRecoItem.clickParam;
        if (!JsonDataManager.VideosDic.ContainsKey(leftItems.contentId))
        {
            JsonDataManager.VideosDic.Add(leftItems.contentId, leftItems);//加载图片完成后,加入字典。根据id添加
        }
        RawImage raw = dataItem.Find("poster").GetComponent <RawImage>();

        JsonDataManager.instance.SetImage(JsonDataManager.leftRecoItem.cover, leftItems, raw);


        int num = 0;

        foreach (Button item in RecommendConntent.GetComponentsInChildren <Button>())
        {
            item.transform.Find("name").GetComponent <Text>().text = JsonDataManager.childrenItems[num].title;
            RawImage rawIm = item.transform.Find("poster").GetComponent <RawImage>();
            item.name = JsonDataManager.childrenItems[num].contentId;//把每个item控件名称为id
            VideoItem Items = new VideoItem();
            Items.contentId  = JsonDataManager.childrenItems[num].contentId;
            Items.title      = JsonDataManager.childrenItems[num].title;
            Items.subscript  = JsonDataManager.childrenItems[num].subscript;
            Items.clickType  = JsonDataManager.childrenItems[num].clickType;
            Items.clickParam = JsonDataManager.childrenItems[num].clickParam;
            //Items.coverTexture = JsonDataManager.childrenItems[num].cover;
            if (!JsonDataManager.VideosDic.ContainsKey(Items.contentId))
            {
                //
                //  Debug.Log(Items.name);
                JsonDataManager.VideosDic.Add(Items.contentId, Items);//加载图片完成后,加入字典。根据id添加
            }
            JsonDataManager.instance.SetImage(JsonDataManager.childrenItems[num].cover, Items, rawIm);
            num++;
        }
    }
        /// <summary>
        /// processes the supplied video and adds it to the supplied list
        /// </summary>
        /// <param name="list">the list of processed items</param>
        /// <param name="itemToProcess">The item that is to be processed</param>
        private void ProcessVideo(ListView list, VideoItem itemToProcess)
        {
            bool processing = true;
            int  segNum     = 0;

            while (processing && !processingWorker.CancellationPending)
            {
                string strCmdText = "python /Model/scripts/run_all_pipeline.py -c ";
                if (segNum == 0)
                {
                    strCmdText += "y";
                }
                else
                {
                    strCmdText += "n";
                }
                strCmdText += " -fd ";
                Dispatcher.Invoke(() =>
                {
                    if (fullDataset.IsChecked == true)
                    {
                        strCmdText += "y";
                    }
                    else
                    {
                        strCmdText += "n";
                    }
                });
                strCmdText += " -sn  -sl  -i ";

                string newSegName = itemToProcess.NewDir.Insert(itemToProcess.NewDir.Length - 4, "-" + segNum.ToString());

                if (System.IO.File.Exists(newSegName))
                {
                    segNum++;
                    Dispatcher.Invoke(() => progressBar.Value = 100 * (((double)segNum - 1) / (videosToProcess)));
                    ComputeSingleSegment(segNum, strCmdText, newSegName);
                }
                else
                {
                    processing = false;
                }
            }
            Dispatcher.Invoke(() => FileManager.CompressAndSaveResults(list,
                                                                       System.IO.Path.GetFileNameWithoutExtension(itemToProcess.Title),
                                                                       saveLocation, processingLocation));
        }
Example #29
0
        /// <summary>
        /// 获取录像信息
        /// </summary>
        /// <param name="page">页码</param>
        /// <param name="num">数量</param>
        private void GetPage(int page, int num)
        {
            if (page == 0)
            {
                page = 1;
            }

            // 清空控件
            last_Page_But.Enabled = false;
            next_Page_But.Enabled = false;
            pictureTableLayoutPanel.Controls.Clear();

            // 查询
            var count = Repository.Repository.GetRecordingsCount(dateTimePickerStart.Value, dateTimePickerEnd.Value);

            if (count == 0)
            {
                return;
            }

            var recordings = Repository.Repository.GetRecordings(dateTimePickerStart.Value, dateTimePickerEnd.Value, page, num);

            if (recordings.Count == 0)
            {
                GetPage(page - 1, num);
                return;
            }

            last_Page_But.Enabled = page > 1;
            next_Page_But.Enabled = page < (count / num) + 1;
            pageIndexLab.Text     = page.ToString();
            totalPageLab.Text     = ((count / num) + 1).ToString();

            pictureTableLayoutPanel.Controls.Clear();
            foreach (var recording in recordings)
            {
                var videoItem = new VideoItem();
                videoItem.checkBox.Visible      = !editBtn.Visible;
                videoItem.pictureBox1.Image     = ImageUtils.LoadImage(recording.snapshotUrl);
                videoItem.pictureBox1.Tag       = recording;
                videoItem.video_name_label.Text = recording.cellName + "-" + recording.deviceName + "-" + recording.channelName + "-" + recording.startTime.Value.ToString("yyyymmdd hh:mm:ss");
                videoItem.pictureBox1.Click    += new EventHandler(pictureBox1_Click);
                pictureTableLayoutPanel.Controls.Add(videoItem);
            }

            this.page = page;
        }
        /// <summary>
        /// This will build an html object tag based on the information provided
        /// </summary>
        /// <param name="player">The player defined under BrightcoveSDK.SitecoreUtil</param>
        /// <param name="objectTagID">The HTML Object ID Tag</param>
        /// <param name="video">The video defined under BrightcoveSDK.SitecoreUtil</param>
        /// <param name="PlaylistID">A Playlist ID for a single playlist video player</param>
        /// <param name="PlaylistIDs">The List of Playlist IDs for a multi playlist video player</param>
        /// <param name="BackgroundColor">The Hex Value in the form: #ffffff</param>
        /// <param name="AutoStart">A flag to cause the video to automatically start playing</param>
        /// <param name="WMode">The wmode </param>
        /// <returns></returns>
        private static string GetEmbedCode(this PlayerItem player, VideoItem video, long PlaylistID, List <long> PlaylistIDs, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID)
        {
            StringBuilder embed = new StringBuilder();

            if (player != null)
            {
                //this one works
                embed.AppendLine("<!-- Start of Brightcove Player -->");
                embed.AppendLine("");
                embed.AppendLine("<div style=\"display:none\"></div>");
                embed.AppendLine("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://admin.brightcove.com/js/BrightcoveExperiences.js\"></script>");
                embed.AppendLine("<object id=\"" + objectTagID + "\" class=\"BrightcoveExperience\">");
                embed.AppendLine("<param name=\"bgcolor\" value=\"" + BackgroundColor + "\" />");
                embed.AppendLine("<param name=\"width\" value=\"" + player.Width.ToString() + "\" />");
                embed.AppendLine("<param name=\"height\" value=\"" + player.Height.ToString() + "\" />");
                embed.AppendLine("<param name=\"playerID\" value=\"" + player.PlayerID + "\" />");

                //add in video ids or playlist ids
                if (player.PlaylistType.Equals(PlayerPlaylistType.None) && video != null)
                {
                    embed.AppendLine("<param name=\"@videoPlayer\" value=\"" + video.VideoID + "\"/>");
                }
                else if (player.PlaylistType.Equals(PlayerPlaylistType.Tabbed) && PlaylistIDs != null)
                {
                    embed.AppendLine("<param name=\"@playlistTabs\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
                }
                else if (player.PlaylistType.Equals(PlayerPlaylistType.ComboBox) && PlaylistIDs != null)
                {
                    embed.AppendLine("<param name=\"@playlistCombo\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
                }
                else if (player.PlaylistType.Equals(PlayerPlaylistType.VideoList) && PlaylistID != -1)
                {
                    embed.AppendLine("<param name=\"@videoList\" value=\"" + PlaylistID.ToString() + "\"/>");
                }

                embed.AppendLine("<param name=\"isVid\" value=\"true\" />");
                embed.AppendLine("<param name=\"autoStart\" value=\"" + AutoStart.ToString().ToLower() + "\" />");
                embed.AppendLine("<param name=\"isUI\" value=\"true\" />");
                embed.AppendLine("<param name=\"dynamicStreaming\" value=\"true\" />");
                embed.AppendLine("<param name=\"wmode\" value=\"" + WMode.ToString() + "\" /> ");
                embed.AppendLine("</object>");
                embed.AppendLine("");
                embed.AppendLine("<!-- End of Brightcove Player -->");
            }
            return(embed.ToString());
        }
Example #31
0
        public async Task <byte[]> GetMovieSubtitle(VideoItem video)
        {
            try
            {
                var movieSub = await openSubClient.GetSubtitleUrl(video);

                if (!string.IsNullOrEmpty(movieSub))
                {
                    return(await openSubClient.DownloadSubtitle(video, movieSub));
                }
            }
            catch (Exception)
            {
                Debug.WriteLine($"Error getting or saving movie: {video.Name} subtitle from opensubtitle");
            }
            return(null);
        }
Example #32
0
        public override async void Execute(object parameter)
        {
            LogHelper.Log("PlayVideoCommand called");

            VideoItem videoVm = null;

            if (parameter is ItemClickEventArgs)
            {
                ItemClickEventArgs args = parameter as ItemClickEventArgs;
                videoVm = args.ClickedItem as VideoItem;
            }
            else if (parameter is VideoItem)
            {
                videoVm = parameter as VideoItem;
            }

            // If the VM is null, we can't do anything. So just return.
            if (videoVm == null)
            {
#if DEBUG
                ToastHelper.Basic("Failed to load the selected video, the video view model is null.");
#endif
                LogHelper.Log("PLAYVIDEO: VideoVm is null, returning");
                return;
            }

            LogHelper.Log("PLAYVIDEO: VideoVm is not null, continuing");
            try
            {
                // If the video file is null (For example, the user deleted the video, and it's on
                // their favorites list.) We need to make sure the whole app does not crash.

                // TODO: If user selectes a video from their favoites, and it has been moved or deleted, we should ask them if we want to remove it from their list

                await Locator.PlaybackService.SetPlaylist(new List <IMediaItem> {
                    videoVm
                });
            }
            catch (System.Exception)
            {
                // TODO: Enhance error handling
                // TODO: Remove hardcoded English
                ToastHelper.Basic(Strings.FailOpenVideo);
                return;
            }
        }
Example #33
0
 void LiveItemClick(Transform button)
 {
     LauncherUIManager.instance.panelBackStatus = PanelBackStatus.LivePlayer;
     //  LivePlayerManager.instance.LiveVideoCanvasRoot.gameObject.SetActive(true );
     if (Application.platform == RuntimePlatform.Android)
     {
         VideoItem data = JsonDataManager.liceItemDic[button.name];
         AndroidAPI.StartActivityForUnityTV189(data.contentId, data.clickType, data.clickParam, data.title, 0);
         // SceneManager.LoadScene("PlayerLive");
     }
     else
     {
         LivePlayDisplay();
         // SceneManager.LoadScene("PlayerLive", LoadSceneMode.Single);
         // mediaPlayerCtrl.Load(MediaPlayerCtrl.m_videoID);
     }
 }
Example #34
0
        public List <VideoItem> AddToPlayList(VideoItem videoItem)
        {
            List <VideoItem> list = LoadPlayList();

            if (list.Exists(x => x.Name == videoItem.Name || x.Path == videoItem.Path))
            {
                return(list);
            }
            doc.Root.Add(new XElement("Item",
                                      new XElement("Name", videoItem.Name),
                                      new XElement("Path", videoItem.Path),
                                      new XElement("Type", videoItem.Type),
                                      new XElement("Duration", videoItem.Duration.Milliseconds)));
            doc.Save(filePath);
            list.Add(videoItem);
            return(list);
        }
 public GenericListItemCollections GetList(SiteItemEntry entry)
 {
     GenericListItemCollections res = new GenericListItemCollections();
       if (entry.GetValue("all") == "true" && entry.GetValue("level") != "false")
       {
     res.Title = entry.Title;
     foreach (KeyValuePair<string, string> keyValuePair in Feeds)
     {
       SiteItemEntry newentry = new SiteItemEntry();
       BillboardItem videoItem = new BillboardItem();
       newentry.Provider = videoItem.Name;
       newentry.Title = keyValuePair.Key;
       newentry.SetValue("feed", keyValuePair.Key);
       res.Items.Add(new GenericListItem()
       {
     IsFolder = false,
     Title = newentry.Title,
     Tag = newentry
       });
     }
       }
       else
       {
     string rssurl = Feeds[entry.GetValue("feed")];
     res.ItemType = ItemType.Video;
     Uri uri = new Uri(rssurl);
     RssChannel myRssChannel = new RssChannel(uri);
     res.Title = myRssChannel.Title;
     foreach (RssItem item in myRssChannel.Items)
     {
       SiteItemEntry newentry = new SiteItemEntry();
       VideoItem videoItem = new VideoItem();
       newentry.Provider = videoItem.Name;
       newentry.Title = item.Title;
       newentry.SetValue("level", "false");
       string[] title = item.Title.Split(',');
       newentry.SetValue("search", title[1].Trim() + " - " + title[0].Split(':')[1]);
       res.Items.Add(new GenericListItem()
                   {
                     IsFolder = false,
                     Title = newentry.Title,
                     Tag = newentry,
                     LogoUrl = ArtistManager.Instance.GetArtistsImgUrl(GetArtistName(title[1])),
                     DefaultImage = "defaultArtistBig.png"
                   });
     }
       }
       return res;
 }
Example #36
0
 private void setPlayersFromArr(JsonArray arr)
 {
     this._player = new Collection<VideoItem>();
     foreach (var a in arr)
     {
         JsonObject item = a.GetObject();
         VideoItem v = new VideoItem();
         if (item.ContainsKey(STR_WIDTH))
             v.Width = (int)item.GetNamedNumber(STR_WIDTH);
         if (item.ContainsKey(STR_EMBED))
             v.Embed = item.GetNamedString(STR_EMBED);
         this._player.Add(v);
     }
 }
        private bool CreateVideoItem(string videoUrl, string videoTitle, string subCategoriesList, int newVideoNodeId)
        {
            //Connect to the Umbraco DB
            var db = ApplicationContext.DatabaseContext.Database;
            var record = db.SingleOrDefault<VideoItem>("WHERE VideoId=@0", _videoService.VideoIdExtractor(videoUrl));

            //No record found in DB - create one for the user
            if (record == null)
            {
                try
                {
                    // create new entry in VideoItemsDB for this video
                    var t = Members.GetCurrentMember().OfType<MyMember>();
                    VideoItem newVideoItem = new VideoItem();
                    newVideoItem.NodeId = newVideoNodeId;
                    newVideoItem.VideoId = _videoService.VideoIdExtractor(videoUrl);
                    newVideoItem.MemberName = Members.GetCurrentMember().Name;
                    //newVideoItem.MemberPicture = Umbraco.TypedMember(Members.GetCurrentMemberId()).GetPropertyValue("picture").ToString();
                    newVideoItem.SubCategories = subCategoriesList;
                    newVideoItem.Date = DateTime.Now;
                    newVideoItem.Comments = 0;
                    newVideoItem.Likes = 0;
                    newVideoItem.Dislikes = 0;
                    newVideoItem.Views = 0;
                    newVideoItem.Shares = 0;
                    newVideoItem.Title = videoTitle;
                    newVideoItem.Url = Umbraco.TypedContent(newVideoNodeId).Url;
                    db.Insert(newVideoItem);
                    return true;
                }

                catch (Exception e)
                {
                   return false;
                }
            }
            else
            {
                //a record found in DB
                return false;
                //log  Json(new { success = false, value = "This Video was already uploaded" });
            }
        }
        public async void DetailsPopulate(VideoItem caller)
        {
            if (_currentlyEditedItem == null)
            {
                DetailsAnimationShow.Begin();
                VideoDetails.Visibility = Visibility.Visible;
            }
            _currentlyEditedItem = caller;
            //Clear
            if (_currentlyEditedItem.AlbumCoverPath == null)
            {
                TagAlbumCover.Source = null;
                _prevCoverPath = null;
                IconBrowseCover.Visibility = Visibility.Visible;             
            }
            else if (_prevCoverPath == null || _prevCoverPath != _currentlyEditedItem.AlbumCoverPath)
            {
                var uri = new Uri(_currentlyEditedItem.AlbumCoverPath);
                if (uri.IsFile)
                {
                    var thumb = await StorageFile.GetFileFromPathAsync(uri.LocalPath);
                    using (var fileStream = await thumb.OpenAsync(Windows.Storage.FileAccessMode.Read))
                    {
                        BitmapImage bitmapImage = new BitmapImage();
                        bitmapImage.SetSource(fileStream);
                        TagAlbumCover.Source = bitmapImage;
                    }
                }
                else
                {
                    TagAlbumCover.Source = new BitmapImage(new Uri(_currentlyEditedItem.AlbumCoverPath));
                }

                IconBrowseCover.Visibility = Visibility.Collapsed;
                _prevCoverPath = _currentlyEditedItem.AlbumCoverPath;
            }
            DetailsTitleSuggestsBox.Items.Clear();
            DetailsArtistSuggestsBox.Items.Clear();
            //Populate data
            if (!caller.suggestions.IsEmpty())
            {
                //title
                DetailsTitleSuggestsBox.Text = caller.tagTitle;
                foreach (var item in caller.suggestions.titles)
                {
                    DetailsTitleSuggestsBox.Items.Add(item);
                }
                //artist
                DetailsArtistSuggestsBox.Text = caller.tagArtist;
                foreach (var item in caller.suggestions.authors)
                {
                    DetailsArtistSuggestsBox.Items.Add(item);
                }
            }
            //Misc
            DetailsAlbum.Text = caller.tagAlbum;
            DetailsTrackNumber.Text = "0";
            DetailsTrimStart.Text = caller.trimStart == null ? "" : caller.trimStart.ToString();
            DetailsTrimEnd.Text = caller.trimEnd == null ? "" : caller.trimEnd.ToString();
        }
 private void DetailsClose(object sender, RoutedEventArgs e)
 {
     //_currentlyEditedItem.DisableTextSelection();
     _currentlyEditedItem = null;
     DetailsAnimationHide.Begin();
     DetailsAnimationHide.Completed += (o, o1) => { VideoDetails.Visibility = Visibility.Collapsed; };
 }
Example #40
0
        void ProcessesList()
        {
            List<VideoItem> videos = new List<VideoItem> ();
            List<SongMusicItem> songs = new List<SongMusicItem> ();
            List<PodcastItem> podcasts = new List<PodcastItem> ();

            foreach (IDictionary<string, object> result in indexed_items)
            {
                IMediaFile item;
                string path, artPath, mediaType;
                Dictionary<string, string> tags;

                tags = SetupTags ();
                foreach (string tag in export_fields) {
                    object objTag;

                    result.TryGetValue (tag, out objTag);
                    tags [tag] = (objTag == null) ? "" : objTag.ToString ();
                }

                mediaType = tags ["media-attributes"];

                // some items dont have a local-path, we need to use the URI in this case.
                path = string.IsNullOrEmpty (tags ["local-path"]) ? tags ["URI"] : tags ["local-path"];
                artPath = string.IsNullOrEmpty (tags ["artwork-id"]) ? "" : Path.Combine (artwork_directory, tags ["artwork-id"] + ".jpg");

                //Handle videos in the collection
                if (mediaType.Contains ("VideoStream")) {
                    item = new VideoItem (tags ["name"], tags ["artist"], tags ["year"], artPath, path);

                    videos.Add (item as VideoItem);

                //Handle the podcasts in collection
                } else if (mediaType.Contains ("Podcast")) {
                    item = new PodcastPodcastItem (tags ["name"], tags ["album"], tags ["year"], artPath, path);

                    podcasts.Add (item as PodcastPodcastItem);

                //everything else should be Music
                } else {
                    item = new SongMusicItem (tags ["name"], tags ["artist"], tags ["album"], tags ["year"],
                        artPath, tags ["track-number"], path);

                    songs.Add (item as SongMusicItem);
                }

                Videos = videos;
                Songs = songs;
                Podcasts = podcasts;
            }
        }