コード例 #1
0
        private void InitMediaPlayer()
        {
            try
            {
                //var onInfoListener = new OnInfoListener(this);
                //var onSeekCompleteListener = new OnSeekCompleteListener();
                //var onCompletionListener = new OnCompletionListener();
                //var onControllerEventsListener = new OnControllerEventsListener();

                //配置播放器
                MediaController mMediaController = new MediaController(this);
                mMediaController.SetTitle("123321");// setTitle(title);

                mPlayerView.SetVideoLayout(mPlayerView.Id);
                mPlayerView.SetMediaController(mMediaController);
                mPlayerView.RequestFocus();
                mPlayerView.SetMediaBufferingIndicator(mBufferingIndicator);
                mPlayerView.SetOnInfoListener(this);
                mPlayerView.SetOnSeekCompleteListener(this);
                mPlayerView.SetOnCompletionListener(this);
                mPlayerView.SetOnControllerEventsListener(this);

                //设置返回键监听
                mMediaController.SetVideoBackEvent(this);

                //LoadData();
            }
            catch (Java.Lang.Exception e)
            {
                Log.Error(TAG, "InitMediaPlayer--" + e.ToString());
            }
        }
コード例 #2
0
        private void InitMediaPlayer()
        {
            try
            {
                //var onInfoListener = new OnInfoListener(this);
                //var onSeekCompleteListener = new OnSeekCompleteListener();
                //var onCompletionListener = new OnCompletionListener();
                //var onControllerEventsListener = new OnControllerEventsListener();

                //配置播放器
                MediaController mMediaController = new MediaController(this);
                mMediaController.SetTitle(title);// setTitle(title);

                mPlayerView.SetVideoLayout(mPlayerView.Id);
                mPlayerView.SetMediaController(mMediaController);
                mPlayerView.SetMediaBufferingIndicator(mBufferingIndicator);
                mPlayerView.RequestFocus();

                mPlayerView.SetOnInfoListener(this);
                mPlayerView.SetOnSeekCompleteListener(this);
                mPlayerView.SetOnCompletionListener(this);
                mPlayerView.SetOnControllerEventsListener(this);

                //设置返回键监听
                mMediaController.SetVideoBackEvent(this);

                #region 弹幕
                //设置弹幕开关监听
                //mMediaController.SetDanmakuSwitchListener(this);
                //配置弹幕库
                //mDanmakuView.enableDanmakuDrawingCache(true);
                ////设置最大显示行数
                //HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
                ////滚动弹幕最大显示5行
                //maxLinesPair.Put(BaseDanmaku.TYPE_SCROLL_RL, 5);
                ////设置是否禁止重叠
                //HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
                //overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
                //overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
                ////设置弹幕样式
                //danmakuContext = DanmakuContext.create();
                //danmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
                //        .setDuplicateMergingEnabled(false)
                //        .setScrollSpeedFactor(1.2f)
                //        .setScaleTextSize(0.8f)
                //        .setMaximumLines(maxLinesPair)
                //        .preventOverlapping(overlappingEnablePair);
                #endregion

                LoadData();
            }
            catch (Java.Lang.Exception e)
            {
                Log.Error(TAG, "InitMediaPlayer--" + e.ToString());
            }
        }