... | ... | @@ -399,9 +399,73 @@ player.setOnExercisesMsgListener(new OnExercisesMsgListener() { |
|
|
}
|
|
|
```
|
|
|
|
|
|
## 4.13 错误处理
|
|
|
## 4.13 投屏功能
|
|
|
在播放时可以投射到电视或其他支持投屏的设备,分为非加密视频的投屏和加密视频的投屏。
|
|
|
### 4.13.1 非加密视频的投屏
|
|
|
```
|
|
|
//搜索发现设备
|
|
|
registryListener.setOnDeviceListChangedListener(new ProjectionDeviceListChangedListener() {
|
|
|
@Override
|
|
|
public void onDeviceAdded(ProjectionIDevice device) {
|
|
|
//发现设备
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onDeviceRemoved(ProjectionIDevice device) {
|
|
|
//设备移除
|
|
|
}
|
|
|
});
|
|
|
```
|
|
|
|
|
|
```
|
|
|
//播放新的视频
|
|
|
projectionPlayControl.playNew(playUrl, new ProjectionControlCallback() {
|
|
|
@Override
|
|
|
public void success(ProjectionIResponse response) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void fail(ProjectionIResponse response) {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
```
|
|
|
```
|
|
|
//暂停后恢复播放
|
|
|
projectionPlayControl.play(new ProjectionControlCallback() {
|
|
|
@Override
|
|
|
public void success(ProjectionIResponse response) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void fail(ProjectionIResponse response) {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
```
|
|
|
```
|
|
|
//暂停播放
|
|
|
projectionPlayControl.pause(new ProjectionControlCallback() {
|
|
|
@Override
|
|
|
public void success(ProjectionIResponse response) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void fail(ProjectionIResponse response) {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
```
|
|
|
|
|
|
### 4.13.2 加密视频的投屏
|
|
|
加密视频不可直接投屏,请打开手机的投屏功能,详情参考Demo。
|
|
|
|
|
|
## 4.14 错误处理
|
|
|
错误信息有两种,一种是播放器触发的错误,另一种是获得场景视频自定义的错误。
|
|
|
### 4.13.1 监听播放器的错误事件
|
|
|
### 4.14.1 监听播放器的错误事件
|
|
|
DWMediaPlayer重载了MediaPlayer的setOnErrorListener()方法,如果需要在应用中提示错误信息,可调用此方法设置OnErrorListener。具体实现方式如下:
|
|
|
|
|
|
```
|
... | ... | @@ -413,7 +477,7 @@ player.setOnErrorListener(new MediaPlayer.OnErrorListener() { |
|
|
}
|
|
|
});
|
|
|
```
|
|
|
### 4.13.2 监听获得场景视频自定义的错误事件
|
|
|
### 4.14.2 监听获得场景视频自定义的错误事件
|
|
|
|
|
|
```
|
|
|
player.setOnDreamWinErrorListener(new OnDreamWinErrorListener() {
|
... | ... | @@ -425,9 +489,9 @@ player.setOnDreamWinErrorListener(new OnDreamWinErrorListener() { |
|
|
```
|
|
|
|
|
|
|
|
|
## 4.14 错误码
|
|
|
## 4.15 错误码
|
|
|
|
|
|
### 4.14.1 HuodeException自定义的错误码
|
|
|
### 4.15.1 HuodeException自定义的错误码
|
|
|
|
|
|
```
|
|
|
101:无播放节点
|
... | ... | @@ -497,7 +561,7 @@ player.setOnDreamWinErrorListener(new OnDreamWinErrorListener() { |
|
|
505:加载数据失败
|
|
|
```
|
|
|
|
|
|
### 4.14.2 ijkplayer错误码
|
|
|
### 4.15.2 ijkplayer错误码
|
|
|
|
|
|
```
|
|
|
int MEDIA_INFO_UNKNOWN = 1;//未知信息
|
... | ... | |