本文整理匯總了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();
}