Ejemplo n.º 1
0
 protected override void OnResume()
 {
     if (mPosition > 0)
     {
         mVideoView.SeekTo(mPosition);
         mPosition = 0;
     }
     base.OnResume();
     mVideoView.Start();
 }
Ejemplo n.º 2
0
        public void initListner()
        {
            sb_voice.ProgressChanged += ((sender, e) => {
                if (e.FromUser)
                {
                    setStreamVolume(e.Progress);
                }
            });
            sb_video.ProgressChanged += delegate(object sender, SeekBar.ProgressChangedEventArgs e) {
                if (e.FromUser)
                {
                    if (vv.IsPlaying)
                    {
                        vv.SeekTo(e.Progress);
                    }
                    else
                    {
                        vv.SeekTo(e.Progress);
                        btn_play.SetBackgroundResource(Resource.Drawable.selector_btn_play);
                    }
                }
            };
            //video buffer listener
            vv.BufferingUpdate += delegate(object sender, IO.Vov.Vitamio.MediaPlayer.BufferingUpdateEventArgs e) {
                updateSecondaryProgress(e);
            };
            //set buffered slow listener
            vv.Info += delegate(object sender, IO.Vov.Vitamio.MediaPlayer.InfoEventArgs e) {
                switch (e.P1)
                {
                //buffer started
                case (int)MediaInfo.BufferingStart:
                    ll_loading.Visibility = ViewStates.Visible;
                    break;

                //buffer end then play
                case (int)MediaInfo.BufferingEnd:
                    hideLoadingCtl();
                    break;

                default:
                    break;
                }
            };
            if (!screen.Type.Equals("audio-text-video"))
            {
                vv.Completion += delegate(object sender, IO.Vov.Vitamio.MediaPlayer.CompletionEventArgs e) {
                    vv.SeekTo(0);
                    tv_current_position.Text = Utils.formatMillis(0L);
                    var activity = Activity as ScreensActivity;
                    //set iswatched
                    editor.PutBoolean(screen.Id + "", true).Commit();
                    tv_loading.Text = "You have watched this video!";
                    activity.validateBtns();
                };
            }

            btn_voice.Click += delegate(object sender, EventArgs e) {
                toggleMute();
            };

            btn_exit.Click += delegate(object sender, EventArgs e) {
                DialogFactory.toastNegativePositiveDialog(Activity, "Return", "Are you sure to return to Lesson List?", Constants.RETURN_LIST_NEG);
            };

            btn_play.Click += delegate(object sender, EventArgs e) {
                play();
            };

            btn_share.Click += delegate(object sender, EventArgs e) {
                //todo:share function
            };
        }