Plays multiple media(videos or whiteboards) at the same time with synchronized progress and speed. Stops when the longest media ended.
AtomPlayer
: Abstract class for anything that is playable.VideoPlayer
: ForExoPlayer
supported media.WhiteboardPlayer
: For Netless Whiteboard replay room.OffsetPlayer
: Add blank offset before anAtomPlayer
.SelectionPlayer
: Cherry-pick segments of anAtomPlayer
.SyncPlayer
: Factory class for grouping AtomPlayers.
- Android SDK Version >= 21
- Android Tools Build >= 4.1.0
// project build
allprojects {
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}
// app build
android {
// ...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "com.github.netless-io:sync-player-android:1.0.0-beta.1"
}
You may clone this repo and run the app.
see example ClusterPlayerActivity
class Example {
private void initPlayer() {
VideoPlayer videoPlayer1 = new VideoPlayer(this, Constant.ALL_VIDEO_URL[0]);
VideoPlayer videoPlayer2 = new VideoPlayer(this, Constant.ALL_VIDEO_URL[1]);
AtomPlayer finalPlayer = new ClusterPlayer(videoPlayer1, videoPlayer2);
finalPlayer.addPlayerListener(new AtomPlayerListener() {
});
finalPlayer.play();
}
}
You may add a time offset before any AtomPlayer
:
class Example {
private void initPlayer() {
VideoPlayer videoPlayer = new VideoPlayer(this, Constant.ALL_VIDEO_URL[0]);
AtomPlayer finalPlayer = new OffsetPlayer(videoPlayer, 5000L);
finalPlayer.addPlayerListener(new AtomPlayerListener() {
});
finalPlayer.play();
}
}
see example OffsetPlayerActivity
You may trim any AtomPlayer
to selected parts by providing a selection list.
class Example {
private void initPlayer() {
VideoPlayer videoPlayer = new VideoPlayer(this, Constant.ALL_VIDEO_URL[1]);
AtomPlayer finalPlayer = new SelectionPlayer(videoPlayer, new SelectionOptions(
Arrays.asList(
new Selection(5_000, 10_000),
new Selection(15_000, 20_000),
new Selection(30_000, 40_000),
new Selection(60_000, 100_000)
)
));
finalPlayer.addPlayerListener(new AtomPlayerListener() {
});
finalPlayer.play();
}
}
see example SelectionPlayerActivity
Sync videos with Netless Whiteboard Replay.
class Example {
private void onWhitePlayerReady(Player player) {
AtomPlayer videoPlayer = new VideoPlayer(this, Constant.ALL_VIDEO_URL[1]);
AtomPlayer selectionPlayer = new SelectionPlayer(new WhiteboardPlayer(player), new SelectionOptions(
Arrays.asList(
new Selection(5_000, 10_000),
new Selection(15_000, 20_000),
new Selection(30_000, 40_000),
new Selection(60_000, 120_000)
)
));
AtomPlayer finalPlayer = SyncPlayer.combine(selectionPlayer, videoPlayer);
finalPlayer.addPlayerListener(new AtomPlayerListener() {
});
finalPlayer.play();
}
}
see example WhiteSelectionClusterPlayerActivity
All apis see AtomPlayer
atomPlayer.play();
atomPlayer.pause();
atomPlayer.stop();
atomPlayer.seekTo(200);
Duration(in millisecond) of the longest media.
Player progress time(in millisecond).
Player status. see AtomPlayer.AtomPlayerPhase
Idle
Player init status or error statusReady
Player can play immediately.Pause
Player paused by user invokingplayer.pause()
.Playing
Player is playing.Buffering
Player is buffering.Ended
Player ends.