Exemplo n.º 1
0
        private void InitComponent()
        {
            try
            {
                var media = new MediaController(this);
                media.Show(5000);

                ProgressBar            = FindViewById <ProgressBar>(Resource.Id.progress_bar);
                ProgressBar.Visibility = ViewStates.Visible;

                PostVideoView             = FindViewById <VideoView>(Resource.Id.videoView);
                PostVideoView.Completion += PostVideoViewOnCompletion;
                PostVideoView.SetMediaController(media);
                PostVideoView.Prepared += PostVideoViewOnPrepared;
                PostVideoView.CanSeekBackward();
                PostVideoView.CanSeekForward();
                PostVideoView.SetAudioAttributes(new AudioAttributes.Builder().SetUsage(AudioUsageKind.Media).SetContentType(AudioContentType.Movie).Build());

                if (VideoUrl.Contains("http"))
                {
                    PostVideoView.SetVideoURI(Uri.Parse(VideoUrl));
                }
                else
                {
                    var file = Uri.FromFile(new File(VideoUrl));
                    PostVideoView.SetVideoPath(file.Path);
                }

                TabbedMainActivity.GetInstance()?.SetOnWakeLock();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        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);
            }
        }
Exemplo n.º 3
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);
            }
        }
        private void InitComponent()
        {
            try
            {
                MediaC = new MediaController(this);
                MediaC.Show(5000);

                ProgressBar            = FindViewById <ProgressBar>(Resource.Id.progress_bar);
                ProgressBar.Visibility = ViewStates.Visible;

                PostVideoView = FindViewById <VideoView>(Resource.Id.videoView);

                MediaC.SetAnchorView(PostVideoView);

                PostVideoView.Completion += PostVideoViewOnCompletion;
                PostVideoView.SetMediaController(MediaC);
                PostVideoView.Prepared += PostVideoViewOnPrepared;
                PostVideoView.CanSeekBackward();
                PostVideoView.CanSeekForward();
                //PostVideoView.KeepScreenOn = true;
                //PostVideoView.BringToFront();
                //PostVideoView.Activated = true;

                PostVideoView.SetAudioAttributes(new AudioAttributes.Builder().SetUsage(AudioUsageKind.Media).SetContentType(AudioContentType.Movie).Build());

                if (VideoUrl.Contains("http"))
                {
                    PostVideoView.SetVideoURI(Uri.Parse(VideoUrl));
                }
                else
                {
                    var file = Uri.FromFile(new File(VideoUrl));
                    PostVideoView.SetVideoPath(file.Path);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }