protected override void OnResume() { base.OnResume(); activityResumed = true; if (thumbnailLoader != null && player != null) { if (state == State.Uninitialized) { MaybeStartDemo(); } else if (state == State.LoadingThumbnails) { LoadNextThumbnail(); } else { if (state == State.VideoPlaying) { player.Play(); } flipDelayHandler.SendEmptyMessageDelayed(0, FlipDuration); } } }
public void OnInitializationSuccess(IYouTubePlayerProvider provider, IYouTubePlayer player, bool wasRestored) { if (!wasRestored) { player.CueVideo("Uh_rSDdzubg"); player.Play(); } }
public void OnInitializationSuccess(IYouTubePlayerProvider p0, IYouTubePlayer player, bool wasRestored) { if (!wasRestored) { player.CueVideo(youtubeItem.VideoId); player.Play(); } }
protected override void OnElementChanged(ElementChangedEventArgs <YVideoView> args) { base.OnElementChanged(args); try { if (args.OldElement != null) { args.OldElement.OnPlayVideo -= PlayVideo; } if (args.NewElement != null) { if (Control == null) { element = args.NewElement; var vi = LayoutInflater.From(Context); var controller = vi.Inflate(Resource.Layout.y_manager_controls, null); youTubePlayerFragment = MainActivity.Current.SupportFragmentManager.FindFragmentById(Resource.Id.y_fragment) as YouTubePlayerSupportFragment; youTubePlayerFragment.Initialize(Methods.AppSettings.YDeveloperKey, this); youTubePlayerFragment.RetainInstance = true; var relativeLayout = new ARelativeLayout(Context); seeker = controller.FindViewById <SeekBar>(Resource.Id.seek_bar); video_current_time = controller.FindViewById <TextView>(Resource.Id.video_current_time); btnPlay = controller.FindViewById <ImageView>(Resource.Id.y_button); video_duration = controller.FindViewById <TextView>(Resource.Id.video_duration); video_title = controller.FindViewById <TextView>(Resource.Id.video_title); fullscreen_button = controller.FindViewById <ImageView>(Resource.Id.fullscreen_button); youtube_button_prev = controller.FindViewById <ImageView>(Resource.Id.y_button_prev); youtube_button_next = controller.FindViewById <ImageView>(Resource.Id.y_button_next); btnPlay.Click += TogglePlay; //controller.Click += TogglePlay; youtube_button_prev.Click += (sender, e) => { element?.OnPrev(); }; youtube_button_next.Click += (sender, e) => { element?.OnNext(); }; element.GetCurrentMedia += () => Current; element.Stop = () => YPlayer?.Pause(); element.Play = () => YPlayer?.Play(); relativeLayout.AddView(controller); SetNativeControl(relativeLayout); element.OnPlayVideo = PlayVideo; element.Abort = () => aborted = true; element.Reset = () => aborted = false; element.SetFullScrean = n => { fullScrean = !n; Fullscreen_button_Click(null, null); }; fullscreen_button.Click += Fullscreen_button_Click; } } } catch (Exception e) { Methods.AppSettings.Logger?.Error(e); } }
public void OnSeekTo(int p0) { YPlayer.Play(); CheckState(); }