Beispiel #1
0
 protected override void OnCreate(Bundle icicle)
 {
     base.OnCreate(icicle);
     if (!LibsChecker.CheckVitamioLibs(this))
     {
         return;
     }
     SetContentView(Resource.Layout.videoview);
     mEditText  = FindViewById <EditText>(Resource.Id.url);
     mVideoView = (VideoView)FindViewById <VideoView>(Resource.Id.surface_view);
     if (path == "")
     {
         // Tell the user to provide a media file URL/path.
         Toast.MakeText(this, "Please edit VideoViewDemo Activity, and set path" + " variable to your media file URL/path", ToastLength.Long).Show();
         return;
     }
     else
     {
         //
         //			 * Alternatively,for streaming media you can use
         //			 * mVideoView.setVideoURI(Uri.parse(URLstring));
         //
         mVideoView.SetVideoPath(path);
         mVideoView.SetMediaController(new IO.Vov.Vitamio.Widget.MediaController(this));
         mVideoView.RequestFocus();
         mVideoView.Prepared += (object sender, MediaPlayer.PreparedEventArgs e) => e.P0.SetPlaybackSpeed(1.0f);
     }
 }
 //  *
 //   *
 //   * Called when the activity is first created.
 //
 protected override void OnCreate(Bundle icicle)
 {
     base.OnCreate(icicle);
     if (!LibsChecker.CheckVitamioLibs(this))
     {
         return;
     }
     SetContentView(Resource.Layout.mediaplayer_3);
     mTextureView = FindViewById <TextureView>(Resource.Id.surface);
     mTextureView.SurfaceTextureListener = this;
 }
Beispiel #3
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);
            if (!LibsChecker.CheckVitamioLibs(this))
            {
                return;
            }
            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
Beispiel #4
0
 //    *
 //	 *
 //	 * Called when the activity is first created.
 //
 protected override void OnCreate(Bundle icicle)
 {
     base.OnCreate(icicle);
     if (!LibsChecker.CheckVitamioLibs(this))
     {
         return;
     }
     SetContentView(Resource.Layout.mediaplayer_2);
     mPreview = FindViewById <SurfaceView>(Resource.Id.surface);
     holder   = mPreview.Holder;
     holder.AddCallback(this);
     holder.SetFormat(Format.Rgba8888);
     extras = Intent.Extras;
 }
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     if (!LibsChecker.CheckVitamioLibs(this))
     {
         return;
     }
     SetContentView(Resource.Layout.subtitle1);
     tv      = (TextView)FindViewById(Resource.Id.sub1);
     splayer = (SurfaceView)FindViewById(Resource.Id.surface);
     sholder = splayer.Holder;
     sholder.SetFormat(Format.Rgba8888);
     sholder.AddCallback(this);
 }
 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);
 }
        protected override void OnCreate(Bundle icicle)
        {
            base.OnCreate(icicle);
            if (!LibsChecker.CheckVitamioLibs(this))
            {
                return;
            }
            SetContentView(Resource.Layout.subtitle2);
            mVideoView    = FindViewById <VideoView> (Resource.Id.surface_view);
            mSubtitleView = FindViewById <TextView> (Resource.Id.subtitle_view);

            if (path == "")
            {
                // Tell the user to provide a media file URL/path.
                Toast.MakeText(this, "Please edit VideoViewSubtitle Activity, and set path" + " variable to your media file URL/path", ToastLength.Long).Show();
                return;
            }
            else
            {
                //
                //			 * Alternatively,for streaming media you can use
                //			 * mVideoView.setVideoURI(Uri.parse(URLstring));
                //
                mVideoView.SetVideoPath(path);

                // mVideoView.setMediaController(new MediaController(this));
                mVideoView.RequestFocus();
                mVideoView.Prepared += (object sender, MediaPlayer.PreparedEventArgs e) => {
                    // optional need Vitamio 4.0
                    e.P0.SetPlaybackSpeed(1.0f);
                    mVideoView.AddTimedTextSource(subtitle_path);
                    mVideoView.SetTimedTextShown(true);
                };

                mVideoView.SetOnTimedTextListener(this);
            }
        }
Beispiel #8
0
        protected override void OnCreate(Bundle icicle)
        {
            //base.OnCreate(icicle);
            if (!LibsChecker.CheckVitamioLibs(this))
            {
                return;
            }
            SetContentView(Resource.Layout.videobuffer);
            mVideoView = FindViewById <VideoView> (Resource.Id.buffer);
            pb         = FindViewById <ProgressBar> (Resource.Id.probar);

            downloadRateView = FindViewById <TextView> (Resource.Id.download_rate);
            loadRateView     = FindViewById <TextView> (Resource.Id.load_rate);
            if (path == "")
            {
                // Tell the user to provide a media file URL/path.
                Toast.MakeText(this, "Please edit VideoBuffer Activity, and set path" + " variable to your media file URL/path", ToastLength.Long).Show();
                return;
            }
            else
            {
                //
                //       * Alternatively,for streaming media you can use
                //       * mVideoView.setVideoURI(Uri.parse(URLstring));
                //
                uri = Android.Net.Uri.Parse(path);
                mVideoView.SetVideoURI(uri);
                mVideoView.SetMediaController(new MediaController(this));
                mVideoView.RequestFocus();
                mVideoView.SetOnInfoListener(this);
                mVideoView.SetOnBufferingUpdateListener(this);
                mVideoView.Prepared += (object sender, MediaPlayer.PreparedEventArgs e) => {
                    e.P0.SetPlaybackSpeed(1.0f);
                };
            }
        }