protected override void OnElementChanged(ElementChangedEventArgs <Page> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || this.Element == null)
            {
                return;
            }


            activity = this.Context as Activity;

            videoView = new IO.Vov.Vitamio.Widget.VideoView(Forms.Context);

            videoView.SetVideoPath(UrlCamera.Url);
            videoView.SetMediaController(new IO.Vov.Vitamio.Widget.MediaController(activity));
            videoView.RequestFocus();

            var ll = new LinearLayout(Forms.Context);

            ll.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
            ll.SetPadding(10, 50, 10, 50);


            videoView.Start();

            ll.AddView(videoView);
            AddView(ll);
            NativeView = ll;
        }
Example #2
0
 protected override void OnResume()
 {
     if (mPosition > 0)
     {
         mVideoView.SeekTo(mPosition);
         mPosition = 0;
     }
     base.OnResume();
     mVideoView.Start();
 }
Example #3
0
 public async void initData()
 {
     //register battery change broadcast
     RegisterBatteryChangedReceiver();
     //check vitamio installed?
     if (!LibsChecker.CheckVitamioLibs(Activity))
     {
         return;
     }
     //get video_url
     video_url = Utils.EncodeURL(getVideoUrl());
     if (!string.IsNullOrEmpty(video_url))
     {
         vv.SetVideoURI(Android.Net.Uri.Parse(Utils.EncodeURL(video_url)));
     }
     else
     {
         DialogFactory.ToastDialog(Activity, "Connect error", "Connect error,please try again later!", Constants.RETURN_LIST);
     }
     vv.RequestFocus();
     vv.Prepared += delegate(object sender, IO.Vov.Vitamio.MediaPlayer.PreparedEventArgs e) {
         e.P0.SetPlaybackSpeed(1.0f);                 //start play
         vv.Start();
         //put duration
         string duration = Utils.formatMillis(vv.Duration);                 //set duration
         tv_duration.Text = duration;
         sb_video.Max     = (int)vv.Duration;
         updateCurrentPosition();
         btn_play.SetBackgroundResource(Resource.Drawable.selector_btn_pause);                                                                //set play button
         tv_title.Text = Activity.Intent.GetStringExtra(Constants.LESSON_TITLE) + ":" + Activity.Intent.GetStringExtra(Constants.LESSON_DES); //set video title
         //hide the loading progress bar
         hideLoadingCtl();
     };
     //control volume
     initVolume();
     // scale volume
     maxVlumeScreenHeightScale = ((float)maxVolume) / Utils.getWindowWidth(Activity);
     //set screen width and height
     screenWidth  = Utils.getWindowWidth(Activity);
     screenHeight = Utils.getWindowHeight(Activity);
 }