Beispiel #1
0
        public void SurfaceCreated(ISurfaceHolder holder)
        {
            _player.SetDisplay(holder);
            _player.SetScreenOnWhilePlaying(true);
            _hasValidHolder = true;

            UpdateVideoStretch(_currentStretch);
        }
Beispiel #2
0
        private void InitializePlayer()
        {
            _player = new AndroidMediaPlayer();
            var surfaceView = RenderSurface as SurfaceView;

            if (_hasValidHolder)
            {
                _player.SetDisplay(surfaceView.Holder);
                _player.SetScreenOnWhilePlaying(true);
            }
            else
            {
                surfaceView.Holder.AddCallback(this);
            }

            _player.SetOnErrorListener(this);
            _player.SetOnPreparedListener(this);
            _player.SetOnSeekCompleteListener(this);
            _player.SetOnBufferingUpdateListener(this);

            PlaybackSession.PlaybackStateChanged -= OnStatusChanged;
            PlaybackSession.PlaybackStateChanged += OnStatusChanged;
        }