Пример #1
0
 private void btnPlayer_Click(object sender, EventArgs e)
 {
     try
     {
         MediaPlayer.Player p = new MediaPlayer.Player("http://files.majorsilence.com/mediaservice/video/big_buck_bunny_480p.webm", true, false, true);
         p.Show();
     }
     catch (Exception ex)
     {
         LibMediaServiceCommon.Logging.Instance.WriteLine(ex);
     }
 }
Пример #2
0
        /// <summary>
        /// When an item is clicked attempt to play the video.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ctrl_Click(object sender, EventArgs e)
        {
            if ((Control)sender is CarouselItems)
            {

                this.Parent.Hide();

                try
                {

                    CarouselItems b = (CarouselItems)sender;
                    VideoInfo v = (VideoInfo)b.Tag;
                    LibMediaServiceCommon.SearchMedia search = new LibMediaServiceCommon.SearchMedia();

                    if (v.MediaInfoId == -1)
                    {
                        throw new Exception("No media files to search for.  MediaId is set to -1.");
                    }

                    string url = LibMediaServiceCommon.Downloads.Instance.MediaAddress + "/" + search.Search(v.MediaInfoId);
                    MediaPlayer.Player dlg = new MediaPlayer.Player(url, true, true, true);
                    dlg.ShowDialog();
                }
                catch (Exception ex)
                {
                    LibMediaServiceCommon.Logging.Instance.WriteLine(ex);
                }
                this.Parent.Show();
            }
        }