use of com.herewhite.demo.player.ijk.widget.media.IjkVideoView in project whiteboard-android by netless-io.
the class PlayActivity method setupPlayer.
// region override
protected void setupPlayer() {
final String uuid = getIntent().getStringExtra(StartActivity.EXTRA_ROOM_UUID);
try {
if (mIsUsedExoPlayer) {
// WhiteExoPlayer demo
PlayerView playerView = findViewById(R.id.exo_video_view);
playerView.setVisibility(View.VISIBLE);
mWhiteMediaPlayer = new WhiteExoPlayer(this);
((WhiteExoPlayer) mWhiteMediaPlayer).setPlayerView(playerView);
((WhiteExoPlayer) mWhiteMediaPlayer).setVideoPath("https://white-pan.oss-cn-shanghai.aliyuncs.com/101/oceans.mp4");
} else {
// WhiteIjkPlayer demo
IjkVideoView videoView = findViewById(R.id.ijk_video_view);
videoView.setVisibility(View.VISIBLE);
mWhiteMediaPlayer = new WhiteIjkPlayer(videoView);
((WhiteIjkPlayer) mWhiteMediaPlayer).setVideoPath("https://white-pan.oss-cn-shanghai.aliyuncs.com/101/oceans.mp4");
}
mPlayerSyncManager = new PlayerSyncManager(mWhiteMediaPlayer, new PlayerSyncManager.Callbacks() {
@Override
public void startBuffering() {
Log.d(TAG_Native, "startBuffering: ");
}
@Override
public void endBuffering() {
Log.d(TAG_Native, "endBuffering: ");
}
});
Log.d(TAG_Native, "create success");
} catch (Throwable e) {
Log.e(TAG_Native, "create fail");
}
DemoAPI.Result result = new DemoAPI.Result() {
@Override
public void success(String uuid, String roomToken) {
initPlayer(uuid, roomToken);
}
@Override
public void fail(String message) {
alert("创建回放失败: ", message);
}
};
if (uuid != null) {
demoAPI.getRoomToken(uuid, result);
} else if (demoAPI.hasDemoInfo()) {
demoAPI.getNewRoom(result);
} else {
alert("无数据", "没有房间 uuid");
}
}
Aggregations