本文整理汇总了Java中com.google.android.exoplayer2.SimpleExoPlayer.getPlaybackState方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleExoPlayer.getPlaybackState方法的具体用法?Java SimpleExoPlayer.getPlaybackState怎么用?Java SimpleExoPlayer.getPlaybackState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.exoplayer2.SimpleExoPlayer
的用法示例。
在下文中一共展示了SimpleExoPlayer.getPlaybackState方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: seekOrSkip
import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
private void seekOrSkip() {
if (fsmPlayer == null) {
return;
}
if (fsmPlayer instanceof FsmPlayer) {
if (((FsmPlayer) fsmPlayer).getController() != null) {
SimpleExoPlayer adPlayer = ((FsmPlayer) fsmPlayer).getController().getAdPlayer();
if (adPlayer != null && adPlayer.getPlaybackState() == ExoPlayer.STATE_BUFFERING) {
long position = adPlayer.getCurrentPosition() + 1000 < adPlayer.getDuration() ? adPlayer.getCurrentPosition() + 1000 : adPlayer.getDuration();
adPlayer.seekTo(position);
adPlayer.setPlayWhenReady(true);
return;
}
}
}
}
示例2: updateMovieResumePosition
import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
/**
* update the resume position of the main movice
*
* @param controller
*/
public static void updateMovieResumePosition(PlayerUIController controller) {
if (controller == null) {
return;
}
SimpleExoPlayer moviePlayer = controller.getContentPlayer();
if (moviePlayer != null && moviePlayer.getPlaybackState() != ExoPlayer.STATE_IDLE) {
int resumeWindow = moviePlayer.getCurrentWindowIndex();
long resumePosition = moviePlayer.isCurrentWindowSeekable() ? Math.max(0, moviePlayer.getCurrentPosition())
: C.TIME_UNSET;
controller.setMovieResumeInfo(resumeWindow, resumePosition);
}
}
示例3: performWorkAndupdatePlayerUI
import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
@Override
public void performWorkAndupdatePlayerUI(@Nullable FsmPlayer fsmPlayer, @NonNull PlayerUIController controller, @NonNull PlayerComponentController componentController, @NonNull MediaModel movieMedia, @Nullable AdMediaModel adMedia) {
// doesn't need to do any UI work.
if (isNull(fsmPlayer, controller, componentController, movieMedia, adMedia)) {
return;
}
SimpleExoPlayer moviePlayer = controller.getContentPlayer();
// this mean, user jump out of the activity lifecycle in ReceivedAdState.
if (moviePlayer!=null && moviePlayer.getPlaybackState() == ExoPlayer.STATE_IDLE) {
fsmPlayer.transit(Input.ERROR);
}
}
示例4: doActionAndScheduleNextImpl
import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
@Override
protected void doActionAndScheduleNextImpl(final SimpleExoPlayer player,
final MappingTrackSelector trackSelector, final Surface surface, final Handler handler,
final ActionNode nextAction) {
if (nextAction == null) {
return;
}
if (targetPlaybackState == player.getPlaybackState()) {
nextAction.schedule(player, trackSelector, surface, handler);
} else {
player.addListener(new Player.DefaultEventListener() {
@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (targetPlaybackState == playbackState) {
player.removeListener(this);
nextAction.schedule(player, trackSelector, surface, handler);
}
}
});
}
}
示例5: stopAdandPlayerMovie
import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
private void stopAdandPlayerMovie(PlayerUIController controller, PlayerComponentController componentController, MediaModel movieMedia) {
SimpleExoPlayer adPlayer = controller.getAdPlayer();
SimpleExoPlayer moviePlayer = controller.getContentPlayer();
//first remove the AdPlayer's listener and pause the player
adPlayer.removeListener(componentController.getAdPlayingMonitor());
adPlayer.setPlayWhenReady(false);
//then update the playerView with SimpleExoPlayer and Movie MediaModel
TubiExoPlayerView tubiExoPlayerView = (TubiExoPlayerView) controller.getExoPlayerView();
tubiExoPlayerView.setPlayer(moviePlayer, componentController.getTubiPlaybackInterface());
tubiExoPlayerView.setMediaModel(movieMedia, false);
//prepare the moviePlayer with data source and set it play
boolean haveResumePosition = controller.getMovieResumePosition() != C.TIME_UNSET;
if (moviePlayer.getPlaybackState() == ExoPlayer.STATE_IDLE) {
moviePlayer.prepare(movieMedia.getMediaSource(), !haveResumePosition, false);
}
updatePlayerPosition(moviePlayer, controller);
moviePlayer.setPlayWhenReady(true);
hideVpaidNShowPlayer(controller);
}
示例6: pausePlayer
import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
private static void pausePlayer(SimpleExoPlayer internalPlayer){
internalPlayer.setPlayWhenReady(false);
internalPlayer.getPlaybackState();
}
示例7: startPlayer
import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
private static void startPlayer(SimpleExoPlayer internalPlayer){
internalPlayer.setPlayWhenReady(true);
internalPlayer.getPlaybackState();
}
示例8: pausePlayer
import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
public static void pausePlayer(SimpleExoPlayer player) {
player.setPlayWhenReady(false);
player.getPlaybackState();
}
示例9: startPlayer
import com.google.android.exoplayer2.SimpleExoPlayer; //导入方法依赖的package包/类
public static void startPlayer(SimpleExoPlayer player) {
player.setPlayWhenReady(true);
player.getPlaybackState();
}