/** 关闭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 onMediaRenderOpened(boolean opened) { VDVideoViewController controller = VDVideoViewController.getInstance(mContext); if (controller != null) controller.notifyHideLoading(); if (mVideoView != null) { if (controller != null) controller.pause(); mVideoView.stopPlayback(); ((View) mVideoView).setVisibility(GONE); } DLNAController dlnaController = DLNAController.getInstance(mContext); int max_stream_music_level = dlnaController.getVolumeMax() - dlnaController.getVolumeMin(); if (controller != null) controller.notifySetMaxVolume(max_stream_music_level); }
@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(); } }
@Override public void onMediaRenderSelect(String name, String value) { DLNAController.getInstance(mContext).mSeekPosition = mVideoView.getCurrentPosition(); DLNAController.getInstance(getContext()).mDoSeek = true; }