Java Code Examples for com.google.android.exoplayer2.ExoPlayer#STATE_BUFFERING
The following examples show how to use
com.google.android.exoplayer2.ExoPlayer#STATE_BUFFERING .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExoPlayerAdapter.java From leanback-showcase with Apache License 2.0 | 6 votes |
@Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { mBufferingStart = false; if (playbackState == ExoPlayer.STATE_READY && !mInitialized) { mInitialized = true; if (mSurfaceHolderGlueHost == null || mHasDisplay) { getCallback().onPreparedStateChanged(ExoPlayerAdapter.this); } } else if (playbackState == ExoPlayer.STATE_BUFFERING) { mBufferingStart = true; } else if (playbackState == ExoPlayer.STATE_ENDED) { getCallback().onPlayStateChanged(ExoPlayerAdapter.this); getCallback().onPlayCompleted(ExoPlayerAdapter.this); } notifyBufferingStartEnd(); }
Example 2
Source File: WebPlayerView.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (playbackState != ExoPlayer.STATE_BUFFERING) { if (videoPlayer.getDuration() != C.TIME_UNSET) { controlsView.setDuration((int) (videoPlayer.getDuration() / 1000)); } else { controlsView.setDuration(0); } } if (playbackState != ExoPlayer.STATE_ENDED && playbackState != ExoPlayer.STATE_IDLE && videoPlayer.isPlaying()) { delegate.onPlayStateChanged(this, true); } else { delegate.onPlayStateChanged(this, false); } if (videoPlayer.isPlaying() && playbackState != ExoPlayer.STATE_ENDED) { updatePlayButton(); } else { if (playbackState == ExoPlayer.STATE_ENDED) { isCompleted = true; videoPlayer.pause(); videoPlayer.seekTo(0); updatePlayButton(); controlsView.show(true, true); } } }
Example 3
Source File: WebPlayerView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (playbackState != ExoPlayer.STATE_BUFFERING) { if (videoPlayer.getDuration() != C.TIME_UNSET) { controlsView.setDuration((int) (videoPlayer.getDuration() / 1000)); } else { controlsView.setDuration(0); } } if (playbackState != ExoPlayer.STATE_ENDED && playbackState != ExoPlayer.STATE_IDLE && videoPlayer.isPlaying()) { delegate.onPlayStateChanged(this, true); } else { delegate.onPlayStateChanged(this, false); } if (videoPlayer.isPlaying() && playbackState != ExoPlayer.STATE_ENDED) { updatePlayButton(); } else { if (playbackState == ExoPlayer.STATE_ENDED) { isCompleted = true; videoPlayer.pause(); videoPlayer.seekTo(0); updatePlayButton(); controlsView.show(true, true); } } }
Example 4
Source File: MediaController.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (tag != playerNum) { return; } if (playbackState == ExoPlayer.STATE_ENDED || (playbackState == ExoPlayer.STATE_IDLE || playbackState == ExoPlayer.STATE_BUFFERING) && playWhenReady && messageObject.audioProgress >= 0.999f) { if (!playlist.isEmpty() && (playlist.size() > 1 || !messageObject.isVoice())) { playNextMessageWithoutOrder(true); } else { cleanupPlayer(true, true, messageObject != null && messageObject.isVoice(), false); } } else if (seekToProgressPending != 0 && (playbackState == ExoPlayer.STATE_READY || playbackState == ExoPlayer.STATE_IDLE)) { int seekTo = (int) (audioPlayer.getDuration() * seekToProgressPending); audioPlayer.seekTo(seekTo); lastProgress = seekTo; seekToProgressPending = 0; } }
Example 5
Source File: WebPlayerView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (playbackState != ExoPlayer.STATE_BUFFERING) { if (videoPlayer.getDuration() != C.TIME_UNSET) { controlsView.setDuration((int) (videoPlayer.getDuration() / 1000)); } else { controlsView.setDuration(0); } } if (playbackState != ExoPlayer.STATE_ENDED && playbackState != ExoPlayer.STATE_IDLE && videoPlayer.isPlaying()) { delegate.onPlayStateChanged(this, true); } else { delegate.onPlayStateChanged(this, false); } if (videoPlayer.isPlaying() && playbackState != ExoPlayer.STATE_ENDED) { updatePlayButton(); } else { if (playbackState == ExoPlayer.STATE_ENDED) { isCompleted = true; videoPlayer.pause(); videoPlayer.seekTo(0); updatePlayButton(); controlsView.show(true, true); } } }
Example 6
Source File: AdPlayingMonitor.java From TubiPlayer with MIT License | 6 votes |
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; } } } }
Example 7
Source File: ExoMedia.java From QSVideoPlayer with Apache License 2.0 | 6 votes |
@Override public void onPlayerStateChanged(boolean b, int i) { Log.e("ExoMedia", "onPlayerStateChanged " + b + i); if (i == ExoPlayer.STATE_READY) { //缓冲好了 iMediaCallback.onInfo(this, MEDIA_INFO_BUFFERING_END, MEDIA_INFO_BUFFERING_END); mainThreadHandler.removeCallbacks(runnable); mainThreadHandler.post(runnable); if (!isPrepar) { isPrepar = true; iMediaCallback.onPrepared(this);//第一次初始化 } } //播放完毕 if (i == ExoPlayer.STATE_ENDED) { mainThreadHandler.removeCallbacks(runnable); iMediaCallback.onCompletion(this); } if (i == ExoPlayer.STATE_BUFFERING) iMediaCallback.onInfo(this, MEDIA_INFO_BUFFERING_START, MEDIA_INFO_BUFFERING_START); }
Example 8
Source File: WebPlayerView.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (playbackState != ExoPlayer.STATE_BUFFERING) { if (videoPlayer.getDuration() != C.TIME_UNSET) { controlsView.setDuration((int) (videoPlayer.getDuration() / 1000)); } else { controlsView.setDuration(0); } } if (playbackState != ExoPlayer.STATE_ENDED && playbackState != ExoPlayer.STATE_IDLE && videoPlayer.isPlaying()) { delegate.onPlayStateChanged(this, true); } else { delegate.onPlayStateChanged(this, false); } if (videoPlayer.isPlaying() && playbackState != ExoPlayer.STATE_ENDED) { updatePlayButton(); } else { if (playbackState == ExoPlayer.STATE_ENDED) { isCompleted = true; videoPlayer.pause(); videoPlayer.seekTo(0); updatePlayButton(); controlsView.show(true, true); } } }
Example 9
Source File: MediaController.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (tag != playerNum) { return; } if (playbackState == ExoPlayer.STATE_ENDED || (playbackState == ExoPlayer.STATE_IDLE || playbackState == ExoPlayer.STATE_BUFFERING) && playWhenReady && messageObject.audioProgress >= 0.999f) { if (!playlist.isEmpty() && (playlist.size() > 1 || !messageObject.isVoice())) { playNextMessageWithoutOrder(true); } else { cleanupPlayer(true, true, messageObject != null && messageObject.isVoice(), false); } } else if (seekToProgressPending != 0 && (playbackState == ExoPlayer.STATE_READY || playbackState == ExoPlayer.STATE_IDLE)) { int seekTo = (int) (audioPlayer.getDuration() * seekToProgressPending); audioPlayer.seekTo(seekTo); lastProgress = seekTo; seekToProgressPending = 0; } }
Example 10
Source File: DebugTextViewHelper.java From K-Sonic with MIT License | 6 votes |
private String getPlayerStateString() { String text = "playWhenReady:" + player.getPlayWhenReady() + " playbackState:"; switch (player.getPlaybackState()) { case ExoPlayer.STATE_BUFFERING: text += "buffering"; break; case ExoPlayer.STATE_ENDED: text += "ended"; break; case ExoPlayer.STATE_IDLE: text += "idle"; break; case ExoPlayer.STATE_READY: text += "ready"; break; default: text += "unknown"; break; } return text; }
Example 11
Source File: EventLogger.java From evercam-android with GNU Affero General Public License v3.0 | 5 votes |
private static String getStateString(int state) { switch (state) { case ExoPlayer.STATE_BUFFERING: return "B"; case ExoPlayer.STATE_ENDED: return "E"; case ExoPlayer.STATE_IDLE: return "I"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 12
Source File: PlayerContainerView.java From Anecdote with Apache License 2.0 | 5 votes |
@Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { switch (playbackState) { case ExoPlayer.STATE_READY: case ExoPlayer.STATE_IDLE: case ExoPlayer.STATE_BUFFERING: mIsPlaying = true; break; case ExoPlayer.STATE_ENDED: mIsPlaying = false; break; } }
Example 13
Source File: KExoMediaPlayer.java From K-Sonic with MIT License | 5 votes |
@Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { if (isBuffering && (playbackState == ExoPlayer.STATE_READY || playbackState == ExoPlayer.STATE_ENDED)) { notifyOnInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_END, player.getBufferedPercentage()); isBuffering = false; } if (isPreparing && playbackState == ExoPlayer.STATE_READY) { notifyOnPrepared(); isPreparing = false; } if (isSeekToing && playbackState == ExoPlayer.STATE_READY) { notifyOnSeekComplete(); isSeekToing = false; } switch (playbackState) { case ExoPlayer.STATE_IDLE: break; case ExoPlayer.STATE_BUFFERING: notifyOnInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_START, player.getBufferedPercentage()); isBuffering = true; break; case ExoPlayer.STATE_READY: break; case ExoPlayer.STATE_ENDED: if (isLooping() && player != null) player.seekTo(0); else notifyOnCompletion(); break; } }
Example 14
Source File: KExoMediaPlayer.java From K-Sonic with MIT License | 5 votes |
@Override public boolean isPlaying() { if (player == null) return false; int state = player.getPlaybackState(); switch (state) { case ExoPlayer.STATE_BUFFERING: case ExoPlayer.STATE_READY: return player.getPlayWhenReady(); case ExoPlayer.STATE_IDLE: case ExoPlayer.STATE_ENDED: default: return false; } }
Example 15
Source File: EventLogger.java From TigerVideo with Apache License 2.0 | 5 votes |
private static String getStateString(int state) { switch (state) { case ExoPlayer.STATE_BUFFERING: return "B"; case ExoPlayer.STATE_ENDED: return "E"; case ExoPlayer.STATE_IDLE: return "I"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 16
Source File: EventLogger.java From LiveVideoBroadcaster with Apache License 2.0 | 5 votes |
private static String getStateString(int state) { switch (state) { case ExoPlayer.STATE_BUFFERING: return "B"; case ExoPlayer.STATE_ENDED: return "E"; case ExoPlayer.STATE_IDLE: return "I"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 17
Source File: EventLogger.java From ExoPlayer-Offline with Apache License 2.0 | 5 votes |
private static String getStateString(int state) { switch (state) { case ExoPlayer.STATE_BUFFERING: return "B"; case ExoPlayer.STATE_ENDED: return "E"; case ExoPlayer.STATE_IDLE: return "I"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 18
Source File: EventLogger.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
private static String getStateString(int state) { switch (state) { case ExoPlayer.STATE_BUFFERING: return "B"; case ExoPlayer.STATE_ENDED: return "E"; case ExoPlayer.STATE_IDLE: return "I"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 19
Source File: VideoPlayer.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public boolean isBuffering() { return player != null && lastReportedPlaybackState == ExoPlayer.STATE_BUFFERING; }
Example 20
Source File: VideoPlayer.java From Telegram with GNU General Public License v2.0 | 4 votes |
public boolean isBuffering() { return player != null && lastReportedPlaybackState == ExoPlayer.STATE_BUFFERING; }