use of com.herewhite.sdk.Player in project whiteboard-android by netless-io.
the class PlayActivity method initPlayer.
// endregion
protected void initPlayer(String uuid, String roomToken) {
WhiteSdk whiteSdk = new WhiteSdk(mWhiteboardView, PlayActivity.this, new WhiteSdkConfiguration(demoAPI.getAppId(), true), new UrlInterrupter() {
@Override
public String urlInterrupter(String sourceUrl) {
return sourceUrl;
}
});
PlayerConfiguration playerConfiguration = new PlayerConfiguration(uuid, roomToken);
// 只回放 60 秒。如果时间太长,seek bar 进度条移动不明显。
// 实际播放时,需要对齐原始音视频和白板
playerConfiguration.setDuration(60000L);
whiteSdk.createPlayer(playerConfiguration, this, new Promise<Player>() {
@Override
public void then(Player wPlayer) {
mPlaybackPlayer = wPlayer;
mPlayerSyncManager.setWhitePlayer(mPlaybackPlayer);
setupSeekBar();
if (mWhiteMediaPlayer != null) {
if (mIsUsedExoPlayer) {
((WhiteExoPlayer) mWhiteMediaPlayer).setPlayerSyncManager(mPlayerSyncManager);
} else {
((WhiteIjkPlayer) mWhiteMediaPlayer).setPlayerSyncManager(mPlayerSyncManager);
}
}
// seek 一次才能主动触发
mPlaybackPlayer.seekToScheduleTime(0);
enableBtn();
play();
mSeekBarUpdateHandler.postDelayed(mUpdateSeekBar, 100);
testMarkIdling(true);
}
@Override
public void catchEx(SDKError t) {
alert("create player error, ", t.getJsStack());
}
});
}
use of com.herewhite.sdk.Player in project whiteboard-android by netless-io.
the class PureReplayActivity method initPlayer.
// endregion
protected void initPlayer(String uuid, String roomToken) {
WhiteSdk whiteSdk = new WhiteSdk(whiteboardView, PureReplayActivity.this, new WhiteSdkConfiguration(demoAPI.getAppId(), true), new UrlInterrupter() {
@Override
public String urlInterrupter(String sourceUrl) {
return sourceUrl;
}
});
PlayerConfiguration playerConfiguration = new PlayerConfiguration(uuid, roomToken);
// 只回放 60 秒。如果时间太长,seek bar 进度条移动不明显。
playerConfiguration.setDuration(60000l);
// 如果只想实现部分 PlayerEventListener 可以使用 AbstractPlayerEventListener,替换其中想实现的方法
whiteSdk.createPlayer(playerConfiguration, this, new Promise<Player>() {
@Override
public void then(Player wPlayer) {
player = wPlayer;
setupSeekBar();
wPlayer.seekToScheduleTime(0);
wPlayer.play();
mSeekBarUpdateHandler.postDelayed(mUpdateSeekBar, 100);
enableBtn();
}
@Override
public void catchEx(SDKError t) {
Log.e(TAG, "create player error" + t.getStackTrace().toString());
alert("创建回放失败", t.getJsStack());
}
});
}
Aggregations