private void Init()
        {
            try
            {
                #region initialize
                statusTitle = Intent.GetStringExtra("title");
                videoPath   = Intent.GetStringExtra("videoUrl");
                ID          = Intent.GetIntExtra("videoId", -1);

                TextView     videoTitle                 = FindViewById <TextView>(Resource.Id.toolbar_title);
                VideoView    videoView                  = FindViewById <VideoView>(Resource.Id.full_screen_video);
                LinearLayout btnShareVideo              = FindViewById <LinearLayout>(Resource.Id.btn_share);
                LinearLayout btnShareVideoWithWhatsapp  = FindViewById <LinearLayout>(Resource.Id.btn_share_whatsapp);
                LinearLayout btnShareVideoWithInstagram = FindViewById <LinearLayout>(Resource.Id.btn_share_instagram);
                LinearLayout btnShareVideoWithFacebook  = FindViewById <LinearLayout>(Resource.Id.btn_share_facebook);
                LinearLayout btnDownloadVideo           = FindViewById <LinearLayout>(Resource.Id.btn_download);
                LinearLayout btnLikeVideo               = FindViewById <LinearLayout>(Resource.Id.btn_like);
                progress = FindViewById <ProgressBar>(Resource.Id.loading);
                imgLike  = FindViewById <ImageView>(Resource.Id.img_like);
                imgCover = FindViewById <ImageView>(Resource.Id.img_cover);

                videoTitle.Text = statusTitle;
                Glide.With(this).Load(Intent.GetStringExtra("coverUrl")).Into(imgCover);

                if (Preferences.ContainsKey("favorites", ID.ToString()))
                {
                    imgLike.SetImageResource(Resource.Drawable.heart);
                }

                videoView.SetVideoPath(Intent.GetStringExtra("videoUrl"));
                videoView.SetMediaController(new MediaController(this));
                videoView.SetOnPreparedListener(this);
                videoView.SetOnCompletionListener(this);
                videoView.SetOnErrorListener(this);

                LoadAds();

                int catId = Intent.GetIntExtra("catId", -1);
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.frameLayout, new VideosFragment(catId != -1 ? catId : 3)).Commit();
                #endregion

                #region Buttons Click Events
                btnShareVideoWithWhatsapp.Click  += BtnShareOnWhatsapp_Click;
                btnShareVideoWithInstagram.Click += BtnShareOnInstagram_Click;
                btnShareVideoWithFacebook.Click  += BtnShareOnFacebook_Click;
                btnShareVideo.Click    += BtnShareVideo_Click;
                btnDownloadVideo.Click += BtnDownloadVideo_Click;
                btnLikeVideo.Click     += BtnLikeVideo_Click;
                #endregion
            }
            catch
            {
                Toast.MakeText(this, GetString(Resource.String.error), ToastLength.Short).Show();
            }
        }
        private void InitVideoView()
        {
            try
            {
                StoryVideoView = FindViewById <VideoView>(Resource.Id.VideoView);

                StoryVideoView.SetOnPreparedListener(this);
                StoryVideoView.SetOnCompletionListener(this);
                StoryVideoView.SetAudioAttributes(new AudioAttributes.Builder().SetUsage(AudioUsageKind.Media).SetContentType(AudioContentType.Movie).Build());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.splash);
            Window.AddFlags(WindowManagerFlags.Fullscreen);

            VideoView = FindViewById <VideoView>(Resource.Id.videoviewsplash);
            VideoView.SetOnCompletionListener(this);
            var urlvideo = Android.Net.Uri.Parse("https://cdn.liftoff.io/customers/3372b4e3dc/videos/mobile/9efc794c8999720f15b4.mp4");

            VideoView.SetVideoURI(urlvideo);
            VideoView.Start();

            // Create your application here
        }
Exemplo n.º 4
0
        private void InitVideoView()
        {
            try
            {
                StoryVideoView = FindViewById <VideoView>(Resource.Id.VideoView);

                if (StoryVideoView != null)
                {
                    StoryVideoView.SetOnPreparedListener(this);
                    StoryVideoView.SetOnCompletionListener(this);
                    StoryVideoView.SetAudioAttributes(new AudioAttributes.Builder()?.SetUsage(AudioUsageKind.Media)?.SetContentType(AudioContentType.Movie)?.Build());
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_video);

            String videoPath = Intent.GetStringExtra(VIDEO_PATH);

            VideoView = FindViewById <VideoView>(Resource.Id.videoview_video);

            MediaController mediaController = new MediaController(this);

            mediaController.SetAnchorView(VideoView);

            VideoView.SetMediaController(mediaController);
            VideoView.SetVideoPath(videoPath);
            VideoView.SetOnPreparedListener(new MediaPlayerListener());
            VideoView.SetOnCompletionListener(new MediaPlayerListener());
        }
Exemplo n.º 6
0
        protected override void OnCreate
        (
            Bundle bundle
        )
        {
            base.OnCreate(bundle);

            _audioPath = Intent.GetStringExtra(AudioPathExtra);

            if (_audioPath == null)
            {
                throw new InvalidOperationException(string.Format("'{0}' extra string missing.",
                                                                  AudioPathExtra));
            }

            _orientationListener = new AndroidCameraActivity.DeviceOrientationEventListener
                                   (
                this,
                SensorDelay.Normal,
                OrientationChanged
                                   );

            _orientationListener.Enable();

            SetContentView(Resource.Layout.PlayVideoLayout);

            _videoView = FindViewById <VideoView>(Resource.Id.PlayedVideo);

            _mediaController = new MediaController(this,
                                                   useFastForward: false);

            _mediaController.SetAnchorView(_videoView);
            _videoView.SetMediaController(_mediaController);

            _videoView.SetOnPreparedListener
            (
                new VideoPreparedListener
                (
                    () =>
            {
                _videoView.SeekTo(1);
                _mediaController.Show();
            }
                )
            );

            _videoView.SetOnCompletionListener
            (
                new VideoCompletionListener
                (
                    () => _mediaController.Show()
                )
            );

            _videoView.SetOnErrorListener
            (
                new VideoErrorListener
                (
                    this,
                    _audioPath,
                    getString: (resource) => { return(GetString(resource)); }
                )
            );

            //_imageView.Touch -= TouchImage;
            //_imageView.Touch += TouchImage;

            /*_videoView.Post // wait with image loading until view fully initialised
             * (
             * () => PlayVideoAsync()
             * );*/

            _videoView.SetVideoPath(_audioPath);
        }