/** 关闭DLNA */ private void closeDLNA() { VDVideoViewController controller = VDVideoViewController.getInstance(mContext); VDVideoInfo mVideoInfo = null; if (controller != null) { mVideoInfo = controller.getCurrentVideo(); } unregisterOnDLNAMediaControllerListener(); ((View) mVideoView).setVisibility(VISIBLE); DLNAController.mIsDLNA = false; int progress = VDPlayerSoundManager.getCurrSoundVolume(mContext); int maxVolume = VDPlayerSoundManager.getMaxSoundVolume(mContext); if (controller != null) controller.notifySetCurVolume(progress); if (controller != null) controller.notifySetMaxVolume(maxVolume); if (VDUtility.isLocalUrl(mVideoInfo.mPlayUrl)) { mVideoView.setVideoPath(mVideoInfo.mPlayUrl); } else { mVideoView.setVideoPath(DLNAController.getInstance(mContext).mPlayUrl); } if (!mVideoInfo.mIsLive) { Log.i("DLNA", "back_seek : " + DLNAController.getInstance(mContext).mPosition); mVideoView.seekTo(DLNAController.getInstance(mContext).mPosition); } mVideoView.start(); if (controller != null) controller.notifyShowLoading(); }
@Override public void onPreOpenDLNA() { VDVideoViewController contoller = VDVideoViewController.getInstance(mContext); VDVideoInfo mVideoInfo = null; if (contoller != null) mVideoInfo = contoller.getCurrentVideo(); VDLog.i("DLNA", "onPreOpenDLNA " + mVideoInfo.mTitle); if (mVideoInfo != null) { if (mVideoInfo.mIsLive) { DLNAController.getInstance(getContext()).mPlayUrl = mVideoInfo.getVideoUrl(VDSharedPreferencesUtil.getCurResolution(mContext)); } else { if (VDUtility.isLocalUrl(mVideoInfo.mPlayUrl)) { // 解析 DLNAController.getInstance(getContext()).mPlayUrl = mVideoInfo.getNetUrl(); } else { DLNAController.getInstance(getContext()).mPlayUrl = (mVideoInfo.mRedirectUrl == null ? mVideoInfo.mPlayUrl : mVideoInfo.mRedirectUrl); } } DLNAController.getInstance(getContext()).open(); } }