|
|
|
# v3.x升级v4.x版本demo的变更
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 直播
|
|
|
|
|
|
|
|
注意:如果需要多人连麦功能,请参照[连麦文档](https://hdgit.bokecc.com/ccvideo/Live_Android_Play_SDK/-/wikis/2.3.18.0%E5%8F%8A%E4%B9%8B%E5%90%8E%E7%9B%B4%E6%92%AD%E6%8E%A5%E5%85%A5%E6%96%87%E6%A1%A3#211-%E8%BF%9E%E9%BA%A6%E5%8A%9F%E8%83%BD)
|
|
|
|
|
|
|
|
##### 播放器逻辑调整
|
|
|
|
|
|
|
|
- LiveVideoView
|
|
|
|
|
|
|
|
- 将gradle中的minSdkVersion从原先的17改为18
|
|
|
|
|
|
|
|
- 原先需要在demo层创建TextTureView、player播放器,并且需要监听TextTureView生命周期获取到Surface关联到player,并且将player设置给SDK
|
|
|
|
|
|
|
|
4.0.0之后需要修改布局文件,将TextTureView换成ViewGroup,并且监听DWLiveListener.onLiveStreamViewPrepared(HDMediaView hdMediaView),将hdMediaView添加到ViewGroup中即可
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先需要监听播放器的各种状态,通过player.setPlayerEventListener()来监听
|
|
|
|
|
|
|
|
4.0.0之后需要通过DWLive.setPublishStreamListener(LiveRtmpPlayerCallBack callBack)设置播放器的回调
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先是通过 player.setAntiRecordScreen(activity)来设置防录屏
|
|
|
|
|
|
|
|
4.0.0之后需要通过DWLive.setAntiRecordScreen(activity)来设置防录屏
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先在收到onStreamEnd事,需要调用DWLive.pause()
|
|
|
|
|
|
|
|
4.0.0之后不再需要客户去调用pause()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先开始播放调用DWLive.start()
|
|
|
|
|
|
|
|
4.0.0之后改为DWLive.start(Context context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先收到连麦成功之后会调用 DWLive.getInstance().pause()(视频连麦)、DWLive.getInstance().setVolume(0f, 0f)(音频连麦)
|
|
|
|
|
|
|
|
4.0.0之后在收到连麦之后不需要调用pause()(调用无效)和setVolume()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先退出连麦需要调用DWLive.getInstance().restartVideo()
|
|
|
|
|
|
|
|
4.0.0之后在退出连麦不需要调用restartVideo()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- ##### 2连麦逻辑调整
|
|
|
|
|
|
|
|
- 需要删除原先布局文件中的CCRTCRender
|
|
|
|
- 申请连麦API改为DWLive.callInPreviewWithType()
|
|
|
|
- 成功之后 会通过RTCConnectListener.onRemoteStreamEnable收到远端流可用
|
|
|
|
- 通过pullRemoteStream获取远端流流视图
|
|
|
|
- 将HDMediaVIew添加到对应的viewgroup上即可
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 在线回放
|
|
|
|
|
|
|
|
##### 播放器逻辑调整
|
|
|
|
|
|
|
|
- ReplayVideoView
|
|
|
|
|
|
|
|
- 原先需要在demo层创建TextTureView、player播放器,并且需要监听TextTureView生命周期获取到Surface关联到player,并且将player设置给SDK
|
|
|
|
|
|
|
|
4.0.0之后需要修改布局文件,将TextTureView换成ViewGroup,并且监听ReplayListener.onPlayBackStreamViewPrepared(HDMediaView hdMediaView),将hdMediaView添加到ViewGroup中即可
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先需要监听播放器的各种状态,通过player.setPlayerEventListener()来监听
|
|
|
|
|
|
|
|
4.0.0之后需要通过DWLiveReplay.setReplayPlayerListener(ReplayPlayerListener callBack)设置播放器的回调
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先是通过 player.setAntiRecordScreen(activity)来设置防录屏
|
|
|
|
|
|
|
|
4.0.0之后需要通过DWLiveReplay.setAntiRecordScreen(activity)来设置防录屏
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先在收到onStreamEnd事,需要调用DWLive.pause()
|
|
|
|
|
|
|
|
4.0.0之后不再需要客户去调用pause()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先开始播放调用DWLiveReplay.start()
|
|
|
|
|
|
|
|
4.0.0之后改为DWLiveReplay.start(Context context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 注意播放器的操作都应迁入DWLiveReplay中,比如设置倍速 获取当前进度等
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 离线回放
|
|
|
|
|
|
|
|
##### 播放器逻辑调整
|
|
|
|
|
|
|
|
- LocalReplayVideoView
|
|
|
|
|
|
|
|
- 原先需要在demo层创建TextTureView、player播放器,并且需要监听TextTureView生命周期获取到Surface关联到player,并且将player设置给SDK
|
|
|
|
|
|
|
|
4.0.0之后需要修改布局文件,将TextTureView换成ViewGroup,并且监听ReplayListener.onPlayBackStreamViewPrepared(HDMediaView hdMediaView),将hdMediaView添加到ViewGroup中即可
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先需要监听播放器的各种状态,通过player.setPlayerEventListener()来监听
|
|
|
|
|
|
|
|
4.0.0之后需要通过DWLiveLocalReplay.setReplayPlayerListener(ReplayPlayerListener callBack)设置播放器的回调
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先是通过 player.setAntiRecordScreen(activity)来设置防录屏
|
|
|
|
|
|
|
|
4.0.0之后需要通过DWLiveLocalReplay.setAntiRecordScreen(activity)来设置防录屏
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先在收到播放器的error事件,需要用户主动调用stop
|
|
|
|
|
|
|
|
4.0.0之后不再需要客户去调用stop(),只需要用户关心自己的业务即可
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 原先收到播放器的playComplete(播放完成)事件,需要用户主动调用stop
|
|
|
|
|
|
|
|
4.0.0之后不再需要客户去调用stop(),只需要用户关心自己的业务即可
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 注意播放器的所有操作都已经迁入DWLocalReplay中,比如设置倍速 获取当前进度等
|
|
|
|
|
|
|
|
|