protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();
            videoplayer.IsVisible = false;
            videocover.IsVisible  = true;
            videoinfo.IsVisible   = true;
            playbtn.IsVisible     = true;
            videoplayer.Source    = null;
            videocover.Source     = null;
            UserIcon.Source       = null;
            Bgicon.Source         = null;
            var item = BindingContext as VideoInfo.Datas;

            if (item == null)
            {
                return;
            }
            if (item.data.urlInfo != null)
            {
                source = new UriVideoSource {
                    Uri = item.data.urlInfo.url
                }
            }
            ;
            videocover.Source = item.data.coverUrl;
            if (item.data.creator != null)
            {
                UserIcon.Source = item.data.creator.avatarUrl;
                Bgicon.Source   = item.data.creator.backgroundUrl;
            }
        }
Exemplo n.º 2
0
 public ViewModel(string uri)
 {
     UriSource = new UriVideoSource()
     {
         Uri = uri
     };
 }
Exemplo n.º 3
0
 private async void ButtonPlayBunny_Clicked(object sender, EventArgs e)
 {
     UriVideoSource uriVideoSurce = new UriVideoSource()
     {
         Uri = "https://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4"
     };
     await Navigation.PushAsync(new PlayVideoPage(uriVideoSurce), true);
 }
Exemplo n.º 4
0
        public VideoPlayerPage(string streamUrl, string episodeTitle)
        {
            UriVideoSource uriVideoSurce = new UriVideoSource()
            {
                Uri = streamUrl
            };

            _videoSource = uriVideoSurce;
            this.Title   = episodeTitle;
            InitializeComponent();
        }
        public Task <string> LoadVideoAsync(VideoSource source, CancellationToken cancellationToken = new CancellationToken())
        {
            string         result  = null;
            UriVideoSource source2 = source as UriVideoSource;

            if (source2?.Uri != null)
            {
                result = source2.Uri.AbsoluteUri;
            }
            return(Task.FromResult <string>(result));
        }
Exemplo n.º 6
0
 void GetMvInfo()
 {
     Task.Run(() =>
     {
         var mvinfo = CloudMusicApiHelper.GetMusicVideo(mvid);
         Artists    = new ObservableCollection <ArtistsInfo>();
         if (mvinfo != null)
         {
             if (mvinfo.code == 200)
             {
                 Device.BeginInvokeOnMainThread(() => MvInfo = mvinfo);
                 string videourl = string.Empty;
                 if (!string.IsNullOrWhiteSpace(mvinfo.data.brs._1080))
                 {
                     videourl = mvinfo.data.brs._1080;
                 }
                 else if (!string.IsNullOrWhiteSpace(mvinfo.data.brs._720))
                 {
                     videourl = mvinfo.data.brs._720;
                 }
                 else if (!string.IsNullOrWhiteSpace(mvinfo.data.brs._480))
                 {
                     videourl = mvinfo.data.brs._480;
                 }
                 else if (!string.IsNullOrWhiteSpace(mvinfo.data.brs._240))
                 {
                     videourl = mvinfo.data.brs._240;
                 }
                 if (!string.IsNullOrWhiteSpace(videourl))
                 {
                     UriSource = new UriVideoSource {
                         Uri = videourl
                     }
                 }
                 ;
             }
         }
         var _artists = new ObservableCollection <ArtistsInfo>();
         foreach (var q in mvinfo.data.artists)
         {
             var artistsInfo = CloudMusicApiHelper.GetArtist(q.id.ToString());
             if (artistsInfo != null)
             {
                 if (artistsInfo.code == 200)
                 {
                     _artists.Add(artistsInfo);
                 }
             }
         }
         Artists = _artists;
     });
     GetMiSiMv();
     ListViewLoadMore();
 }
Exemplo n.º 7
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            ResourceVideoSource source    = new ResourceVideoSource();
            UriVideoSource      uriSource = new UriVideoSource();

            uriSource.Uri      = procedureViewModel.Procedure.VideoSource;
            videoPlayer.Source = uriSource;

            videoPlayer.Play();
            videoPlayer.Position = procedureViewModel.VideoPosition;
        }
Exemplo n.º 8
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            ResourceVideoSource source    = new ResourceVideoSource();
            UriVideoSource      uriSource = new UriVideoSource();

            uriSource.Uri      = procedureViewModel.Procedure.VideoSource;
            videoPlayer.Source = uriSource;

            videoPlayer.Play();
            videoPlayer.Position   = procedureViewModel.VideoPosition;
            playPauseButton.Source = ImageSource.FromResource("ESA.Resources.VideoPlayer.pause.png", typeof(ImageResourceExtension).GetTypeInfo().Assembly);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Handle click on particular day.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Day_Event(object sender, EventArgs e)
        {
            Button ClickedButton = (Button)sender;

            int.TryParse(ClickedButton.Text, out int content);

            string Directory;

            if (content <= CurrentDayIndex && CurrentMonthIndex == 12)
            {
                Directory = "/Adventskalender/Tag_" + content.ToString() + ".mp4";

                if (Application.Current.Properties.ContainsKey("id"))
                {
                    if (int.TryParse(Application.Current.Properties["id"].ToString(), out int DayStamp))
                    {
                        if (content > DayStamp)
                        {
                            Application.Current.Properties["id"] = content.ToString();
                        }
                    }
                }
                else
                {
                    Application.Current.Properties["id"] = content.ToString();
                }

                string StreamableLink = GetStreamableLink(Directory);

                VideoSource MyVideoSource = new UriVideoSource()
                {
                    Uri = StreamableLink
                };
                App.Current.MainPage = new VideoPage(MyVideoSource);
            }
            else
            {
                DisplayAlert("Caught You!", "Don't Cheat!", "I'm sorry...");
            }
        }
Exemplo n.º 10
0
        public VideoPage(DetailsViewModel dvm)
        {
            NavigationPage.SetHasNavigationBar(this, false);
            InitializeComponent();

            procedureViewModel = dvm;
            string videoName = procedureViewModel.VideoName;

            ResourceVideoSource source    = new ResourceVideoSource();
            UriVideoSource      uriSource = new UriVideoSource();

            uriSource.Uri = procedureViewModel.Procedure.VideoSource;

            //switch (Device.RuntimePlatform)
            //{
            //    case Device.iOS:
            //        // source.Path = "Videos/eye_surgery.mp4";
            //        source.Path = "Videos/" + videoName;
            //        break;
            //    case Device.Android:
            //        // source.Path = "eye_surgery.mp4";
            //        source.Path = videoName;
            //        break;
            //    case Device.UWP:
            //        // source.Path = "Videos/eye_surgery.mp4";
            //        source.Path = "Videos/" + videoName;
            //        break;
            //}
            player.Source = uriSource;

            // Fade Timer
            fadeTimer.Interval = 3000;
            fadeTimer.Elapsed += (s, e) =>
            {
                Device.BeginInvokeOnMainThread(() => { VideoControls_Tapped(s, e); });
            };
            fadeTimer.Enabled = true;
            fadeTimer.Start();
        }