我在我的应用中使用Brightcove Exoplayer来流式传输视频。但是,我注意到它不能完全处理网络中断(断开连接然后重新连接)。
在以下情况下无法恢复播放:
是否有任何Brightcove认可/解释方式来处理这些用例?
我的代码:
public class BrightCoveActivity extends BrightcovePlayer {
private static final String AUTH_TOKEN = "<The Auth Token>";
private static final String TAG = BrightCoveActivity.class.getSimpleName();
private BrightcoveExoPlayerVideoView brightcoveExoPlayerVideoView;
private EventEmitter eventEmmiter;
private Context mContext;
private MediaController mMediaController;
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
setContentView(R.layout.activity_bright_cove);
brightcoveExoPlayerVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
super.onCreate(savedInstanceState);
mContext = this;
final Catalog catalog = new Catalog(AUTH_TOKEN);
fullScreen();
mMediaController = new MediaController(this);
brightcoveExoPlayerVideoView.setMediaController(mMediaController);
eventEmmiter = brightcoveExoPlayerVideoView.getEventEmitter();
prepareEventEmmiter(); // puts all event listeners in place.
catalog.findVideoByID(VIDEO_ID, new VideoListener() {
@Override
public void onError(String error) {
throw new RuntimeException(error);
}
@Override
public void onVideo(Video video) {
brightcoveExoPlayerVideoView.add(video);
brightcoveExoPlayerVideoView.start();
}
});
}
/*
More code not related to playback
*/
}
答案 0 :(得分:0)
处理此案例的更好方法是收听应用内部的网络更改并从目录中重新获取视频。你需要在执行此操作时处理各种事情(广告管理,如果它在那里,保持当前位置在事件PROGRESS并重新使用相同的目录提取完成后等。)