@Override public boolean isPrepared() { return player.getPlaybackState() != Player.STATE_IDLE && (surfaceHolderGlueHost == null || hasSurface); }
@Override public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) { if (player == null || player.getPlaybackState() == Player.STATE_IDLE) { return; } startOrUpdateNotification(); }
@Override public void onRepeatModeChanged(int repeatMode) { if (player == null || player.getPlaybackState() == Player.STATE_IDLE) { return; } startOrUpdateNotification(); } }
@Override public void onTimelineChanged(Timeline timeline, @Nullable Object manifest, int reason) { if (player == null || player.getPlaybackState() == Player.STATE_IDLE) { return; } startOrUpdateNotification(); }
private boolean isPlaying() { return player != null && player.getPlaybackState() != Player.STATE_ENDED && player.getPlaybackState() != Player.STATE_IDLE && player.getPlayWhenReady(); }
@Override public boolean isPlaying() { int playbackState = player.getPlaybackState(); return playbackState != Player.STATE_IDLE && playbackState != Player.STATE_ENDED && player.getPlayWhenReady(); }
private boolean shouldShowControllerIndefinitely() { if (player == null) { return true; } int playbackState = player.getPlaybackState(); return controllerAutoShow && (playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED || !player.getPlayWhenReady()); }
private void updateBuffering() { if (bufferingView != null) { boolean showBufferingSpinner = player != null && player.getPlaybackState() == Player.STATE_BUFFERING && (showBuffering == SHOW_BUFFERING_ALWAYS || (showBuffering == SHOW_BUFFERING_WHEN_PLAYING && player.getPlayWhenReady())); bufferingView.setVisibility(showBufferingSpinner ? View.VISIBLE : View.GONE); } }
@Override public long getCurrentPosition() { return player.getPlaybackState() == Player.STATE_IDLE ? -1 : player.getCurrentPosition(); }
private void updateErrorMessage() { if (errorMessageView != null) { if (customErrorMessage != null) { errorMessageView.setText(customErrorMessage); errorMessageView.setVisibility(View.VISIBLE); return; } ExoPlaybackException error = null; if (player != null && player.getPlaybackState() == Player.STATE_IDLE && errorMessageProvider != null) { error = player.getPlaybackError(); } if (error != null) { CharSequence errorMessage = errorMessageProvider.getErrorMessage(error).second; errorMessageView.setText(errorMessage); errorMessageView.setVisibility(View.VISIBLE); } else { errorMessageView.setVisibility(View.GONE); } } }
private void updateCurrentItemIndex() { int playbackState = currentPlayer.getPlaybackState(); maybeSetCurrentItemAndNotify( playbackState != Player.STATE_IDLE && playbackState != Player.STATE_ENDED ? currentPlayer.getCurrentWindowIndex() : C.INDEX_UNSET); }
@Override public void play() { if (player.getPlaybackState() == Player.STATE_IDLE) { if (playbackPreparer != null) { playbackPreparer.preparePlayback(); } } else if (player.getPlaybackState() == Player.STATE_ENDED) { controlDispatcher.dispatchSeekTo(player, player.getCurrentWindowIndex(), C.TIME_UNSET); } if (controlDispatcher.dispatchSetPlayWhenReady(player, true)) { getCallback().onPlayStateChanged(this); } }
/* package */ void notifyStateChanged() { int playbackState = player.getPlaybackState(); Callback callback = getCallback(); maybeNotifyPreparedStateChanged(callback); callback.onPlayStateChanged(this); callback.onBufferingStateChanged(this, playbackState == Player.STATE_BUFFERING); if (playbackState == Player.STATE_ENDED) { callback.onPlayCompleted(this); } }
if (player != null) { wasPlayWhenReady = player.getPlayWhenReady(); lastPlaybackState = player.getPlaybackState(); player.addListener(playerListener); if (lastPlaybackState != Player.STATE_IDLE) {
rewind(); } else if (playButton == view) { if (player.getPlaybackState() == Player.STATE_IDLE) { if (playbackPreparer != null) { playbackPreparer.preparePlayback(); } else if (player.getPlaybackState() == Player.STATE_ENDED) { controlDispatcher.dispatchSeekTo(player, player.getCurrentWindowIndex(), C.TIME_UNSET);
int playbackState = player.getPlaybackState(); ExoPlaybackException playbackError = playbackState == Player.STATE_IDLE ? player.getPlaybackError() : null; reportError ? PlaybackStateCompat.STATE_ERROR : mapPlaybackState(player.getPlaybackState(), player.getPlayWhenReady()); if (customError != null) { builder.setErrorMessage(customError.first, customError.second);
&& !player.isCurrentWindowDynamic() && player.getPlayWhenReady() && player.getPlaybackState() == Player.STATE_READY) { builder .setWhen(System.currentTimeMillis() - player.getContentPosition())
int playbackState = player == null ? Player.STATE_IDLE : player.getPlaybackState(); if (playbackState != Player.STATE_IDLE && playbackState != Player.STATE_ENDED) { long delayMs;
boolean playWhenReady = false; if (this.currentPlayer != null) { int playbackState = this.currentPlayer.getPlaybackState(); if (playbackState != Player.STATE_ENDED) { playbackPositionMs = this.currentPlayer.getCurrentPosition();
private void updateBuffering() { if (bufferingView != null) { boolean showBufferingSpinner = showBuffering && player != null && player.getPlaybackState() == Player.STATE_BUFFERING && player.getPlayWhenReady(); bufferingView.setVisibility(showBufferingSpinner ? View.VISIBLE : View.GONE); } }