當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleExoPlayer.getPlaybackState方法代碼示例

本文整理匯總了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;
            }
        }
    }
}
 
開發者ID:Tubitv,項目名稱:TubiPlayer,代碼行數:21,代碼來源:AdPlayingMonitor.java

示例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);
    }
}
 
開發者ID:Tubitv,項目名稱:TubiPlayer,代碼行數:21,代碼來源:FsmPlayer.java

示例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);
    }

}
 
開發者ID:Tubitv,項目名稱:TubiPlayer,代碼行數:17,代碼來源:ReceiveAdState.java

示例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);
        }
      }
    });
  }
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:22,代碼來源:Action.java

示例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);
    }
 
開發者ID:Tubitv,項目名稱:TubiPlayer,代碼行數:28,代碼來源:MoviePlayingState.java

示例6: pausePlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //導入方法依賴的package包/類
private static void pausePlayer(SimpleExoPlayer internalPlayer){
    internalPlayer.setPlayWhenReady(false);
    internalPlayer.getPlaybackState();
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:5,代碼來源:ExoGifPlayer.java

示例7: startPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //導入方法依賴的package包/類
private static void startPlayer(SimpleExoPlayer internalPlayer){
    internalPlayer.setPlayWhenReady(true);
    internalPlayer.getPlaybackState();
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:5,代碼來源:ExoGifPlayer.java

示例8: pausePlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //導入方法依賴的package包/類
public static void pausePlayer(SimpleExoPlayer player) {
    player.setPlayWhenReady(false);
    player.getPlaybackState();
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:5,代碼來源:ExoUtil.java

示例9: startPlayer

import com.google.android.exoplayer2.SimpleExoPlayer; //導入方法依賴的package包/類
public static void startPlayer(SimpleExoPlayer player) {
    player.setPlayWhenReady(true);
    player.getPlaybackState();
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:5,代碼來源:ExoUtil.java


注:本文中的com.google.android.exoplayer2.SimpleExoPlayer.getPlaybackState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。