Java Code Examples for com.google.android.exoplayer.ExoPlayer#STATE_BUFFERING
The following examples show how to use
com.google.android.exoplayer.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: EventLogger.java From WliveTV with Apache License 2.0 | 6 votes |
private 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_PREPARING: return "P"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 2
Source File: EventLogger.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
private 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_PREPARING: return "P"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 3
Source File: DurationLogger.java From iview-android-tv with MIT License | 6 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { state = playbackState; String text = "playWhenReady=" + playWhenReady + ", playbackState="; switch (playbackState) { case ExoPlayer.STATE_BUFFERING: text += "buffering"; break; case ExoPlayer.STATE_ENDED: text += "ended"; break; case ExoPlayer.STATE_IDLE: text += "idle"; break; case ExoPlayer.STATE_PREPARING: text += "preparing"; break; case ExoPlayer.STATE_READY: text += "ready"; break; default: text += "unknown"; break; } Log.d(TAG, text); }
Example 4
Source File: EventLogger.java From iview-android-tv with MIT License | 6 votes |
private 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_PREPARING: return "P"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 5
Source File: VideoPlayerActivity.java From iview-android-tv with MIT License | 6 votes |
private void updatePlaybackState(int playbackState) { PlaybackState.Builder state = new PlaybackState.Builder(); long position = player.getCurrentPosition(); if (ExoPlayer.STATE_PREPARING == playbackState) { state.setState(PlaybackState.STATE_CONNECTING, position, 1.0f); } else if (ExoPlayer.STATE_BUFFERING == playbackState) { state.setState(PlaybackState.STATE_BUFFERING, position, 1.0f); } else { if (player.getPlayerControl().isPlaying()) { state.setState(PlaybackState.STATE_PLAYING, position, 1.0f); } else { state.setState(PlaybackState.STATE_PAUSED, position, 1.0f); } } mediaSession.setPlaybackState(state.build()); }
Example 6
Source File: RichTvInputService.java From androidtv-sample-inputs with Apache License 2.0 | 6 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (mPlayer == null) { return; } if (playWhenReady && playbackState == ExoPlayer.STATE_READY) { notifyTracksChanged(getAllTracks()); String audioId = getTrackId(TvTrackInfo.TYPE_AUDIO, mPlayer.getSelectedTrack(TvTrackInfo.TYPE_AUDIO)); String videoId = getTrackId(TvTrackInfo.TYPE_VIDEO, mPlayer.getSelectedTrack(TvTrackInfo.TYPE_VIDEO)); String textId = getTrackId(TvTrackInfo.TYPE_SUBTITLE, mPlayer.getSelectedTrack(TvTrackInfo.TYPE_SUBTITLE)); notifyTrackSelected(TvTrackInfo.TYPE_AUDIO, audioId); notifyTrackSelected(TvTrackInfo.TYPE_VIDEO, videoId); notifyTrackSelected(TvTrackInfo.TYPE_SUBTITLE, textId); notifyVideoAvailable(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Math.abs(mPlayer.getPlaybackSpeed() - 1) < 0.1 && playWhenReady && playbackState == ExoPlayer.STATE_BUFFERING) { notifyVideoUnavailable(TvInputManager.VIDEO_UNAVAILABLE_REASON_BUFFERING); } }
Example 7
Source File: IjkExoMediaPlayer.java From WliveTV with Apache License 2.0 | 6 votes |
@Override public boolean isPlaying() { if (mInternalPlayer == null) return false; int state = mInternalPlayer.getPlaybackState(); switch (state) { case ExoPlayer.STATE_BUFFERING: case ExoPlayer.STATE_READY: return mInternalPlayer.getPlayWhenReady(); case ExoPlayer.STATE_IDLE: case ExoPlayer.STATE_PREPARING: case ExoPlayer.STATE_ENDED: default: return false; } }
Example 8
Source File: EventLogger.java From AndroidTvDemo with Apache License 2.0 | 6 votes |
private 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_PREPARING: return "P"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 9
Source File: EventLogger.java From Mobilyzer with Apache License 2.0 | 6 votes |
private 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_PREPARING: return "P"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 10
Source File: EventLogger.java From ShareBox with Apache License 2.0 | 6 votes |
private 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_PREPARING: return "P"; case ExoPlayer.STATE_READY: return "R"; default: return "?"; } }
Example 11
Source File: IjkExoMediaPlayer.java From AndroidTvDemo with Apache License 2.0 | 6 votes |
@Override public boolean isPlaying() { if (mInternalPlayer == null) return false; int state = mInternalPlayer.getPlaybackState(); switch (state) { case ExoPlayer.STATE_BUFFERING: case ExoPlayer.STATE_READY: return mInternalPlayer.getPlayWhenReady(); case ExoPlayer.STATE_IDLE: case ExoPlayer.STATE_PREPARING: case ExoPlayer.STATE_ENDED: default: return false; } }
Example 12
Source File: PlayerActivity.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (playbackState == ExoPlayer.STATE_ENDED) { showControls(); } String text = "playWhenReady=" + playWhenReady + ", playbackState="; switch(playbackState) { case ExoPlayer.STATE_BUFFERING: text += "buffering"; break; case ExoPlayer.STATE_ENDED: text += "ended"; break; case ExoPlayer.STATE_IDLE: text += "idle"; break; case ExoPlayer.STATE_PREPARING: text += "preparing"; break; case ExoPlayer.STATE_READY: text += "ready"; break; default: text += "unknown"; break; } playerStateTextView.setText(text); updateButtonVisibilities(); }
Example 13
Source File: VideoPlayerActivity.java From droidkaigi2016 with Apache License 2.0 | 5 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (playbackState == ExoPlayer.STATE_ENDED) { showControls(); } String text = "playWhenReady=" + playWhenReady + ", playbackState="; switch (playbackState) { case ExoPlayer.STATE_BUFFERING: text += "buffering"; break; case ExoPlayer.STATE_ENDED: text += "ended"; break; case ExoPlayer.STATE_IDLE: text += "idle"; break; case ExoPlayer.STATE_PREPARING: text += "preparing"; break; case ExoPlayer.STATE_READY: text += "ready"; break; default: text += "unknown"; break; } Log.d(TAG, text); }
Example 14
Source File: EventLogger.java From Mobilyzer with Apache License 2.0 | 5 votes |
@Override public void onStateChanged(boolean playWhenReady, int state) { Log.d(TAG, "state [" + getSessionTimeString() + ", " + playWhenReady + ", " + getStateString(state) + "]"); // DecimalFormat df = new DecimalFormat("#.##"); switch(state) { case ExoPlayer.STATE_PREPARING: // this.bitrateVarience.add(Pair.create("0.00", currentBitrate)); this.initialLoadingTime_s = Double.parseDouble(getSessionTimeString()); break; case ExoPlayer.STATE_BUFFERING: bufferCounter++; bufferTime_s = Double.parseDouble(getSessionTimeString()); break; case ExoPlayer.STATE_READY: if (bufferCounter == 1) { this.initialLoadingTime = Double.parseDouble(String.format("%.2f", Double.parseDouble(getSessionTimeString()) - this.initialLoadingTime_s)); } else { this.rebufferTime.add(Double.parseDouble(String.format("%.2f", Double.parseDouble(getSessionTimeString()) - bufferTime_s))); } break; case ExoPlayer.STATE_ENDED: this.videoBitrateVarience.add(Pair.create(getSessionTimeString(), this.previousVideoBitrate)); this.audioBitrateVarience.add(Pair.create(getSessionTimeString(), this.previousAudioBitrate)); // printStatInfo(); break; } }
Example 15
Source File: PlayerActivity.java From Android-Example-HLS-ExoPlayer with Apache License 2.0 | 5 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (playbackState == ExoPlayer.STATE_ENDED) { showControls(); } String text = "playWhenReady=" + playWhenReady + ", playbackState="; switch (playbackState) { case ExoPlayer.STATE_BUFFERING: text += "buffering"; break; case ExoPlayer.STATE_ENDED: text += "ended"; break; case ExoPlayer.STATE_IDLE: text += "idle"; break; case ExoPlayer.STATE_PREPARING: text += "preparing"; break; case ExoPlayer.STATE_READY: text += "ready"; break; default: text += "unknown"; break; } playerStateTextView.setText(text); updateButtonVisibilities(); }
Example 16
Source File: VideoPlayerView.java From iview-android-tv with MIT License | 5 votes |
public void onStateChanged(boolean playWhenReady, int playbackState) { if (playbackState == ExoPlayer.STATE_ENDED) { showControls(); } String text = "playWhenReady=" + playWhenReady + ", playbackState="; switch (playbackState) { case ExoPlayer.STATE_BUFFERING: text += "buffering"; showStatusText(R.string.buffering); break; case ExoPlayer.STATE_ENDED: text += "ended"; break; case ExoPlayer.STATE_IDLE: text += "idle"; break; case ExoPlayer.STATE_PREPARING: text += "preparing"; showStatusText(R.string.loading); break; case ExoPlayer.STATE_READY: text += "ready"; hideStatusText(); showShutter(false); if (mPlayer != null && mPlayer.isPlaying()) { hideControlsDelayed(); } break; default: text += "unknown"; break; } playerStateTextView.setText(text); }
Example 17
Source File: VideoPlayerActivity.java From droidkaigi2016 with Apache License 2.0 | 5 votes |
@Override public void onStateChanged(boolean playWhenReady, int playbackState) { if (playbackState == ExoPlayer.STATE_ENDED) { showControls(); } String text = "playWhenReady=" + playWhenReady + ", playbackState="; switch (playbackState) { case ExoPlayer.STATE_BUFFERING: text += "buffering"; break; case ExoPlayer.STATE_ENDED: text += "ended"; break; case ExoPlayer.STATE_IDLE: text += "idle"; break; case ExoPlayer.STATE_PREPARING: text += "preparing"; break; case ExoPlayer.STATE_READY: text += "ready"; break; default: text += "unknown"; break; } Log.d(TAG, text); }
Example 18
Source File: IjkExoMediaPlayer.java From WliveTV with Apache License 2.0 | 4 votes |
public void onStateChanged(boolean playWhenReady, int playbackState) { if (mIsBuffering) { switch (playbackState) { case ExoPlayer.STATE_ENDED: case ExoPlayer.STATE_READY: notifyOnInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_END, mInternalPlayer.getBufferedPercentage()); mIsBuffering = false; break; } } if (mIsPrepareing) { switch (playbackState) { case ExoPlayer.STATE_READY: notifyOnPrepared(); mIsPrepareing = false; mDidPrepare = false; break; } } switch (playbackState) { case ExoPlayer.STATE_IDLE: notifyOnCompletion(); break; case ExoPlayer.STATE_PREPARING: mIsPrepareing = true; break; case ExoPlayer.STATE_BUFFERING: notifyOnInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_START, mInternalPlayer.getBufferedPercentage()); mIsBuffering = true; break; case ExoPlayer.STATE_READY: break; case ExoPlayer.STATE_ENDED: notifyOnCompletion(); break; default: break; } }
Example 19
Source File: IjkExoMediaPlayer.java From ShareBox with Apache License 2.0 | 4 votes |
public void onStateChanged(boolean playWhenReady, int playbackState) { if (mIsBuffering) { switch (playbackState) { case ExoPlayer.STATE_ENDED: case ExoPlayer.STATE_READY: notifyOnInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_END, mInternalPlayer.getBufferedPercentage()); mIsBuffering = false; break; } } if (mIsPrepareing) { switch (playbackState) { case ExoPlayer.STATE_READY: notifyOnPrepared(); mIsPrepareing = false; mDidPrepare = false; break; } } switch (playbackState) { case ExoPlayer.STATE_IDLE: notifyOnCompletion(); break; case ExoPlayer.STATE_PREPARING: mIsPrepareing = true; break; case ExoPlayer.STATE_BUFFERING: notifyOnInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_START, mInternalPlayer.getBufferedPercentage()); mIsBuffering = true; break; case ExoPlayer.STATE_READY: break; case ExoPlayer.STATE_ENDED: notifyOnCompletion(); break; default: break; } }
Example 20
Source File: IjkExoMediaPlayer.java From AndroidTvDemo with Apache License 2.0 | 4 votes |
public void onStateChanged(boolean playWhenReady, int playbackState) { if (mIsBuffering) { switch (playbackState) { case ExoPlayer.STATE_ENDED: case ExoPlayer.STATE_READY: notifyOnInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_END, mInternalPlayer.getBufferedPercentage()); mIsBuffering = false; break; } } if (mIsPrepareing) { switch (playbackState) { case ExoPlayer.STATE_READY: notifyOnPrepared(); mIsPrepareing = false; mDidPrepare = false; break; } } switch (playbackState) { case ExoPlayer.STATE_IDLE: notifyOnCompletion(); break; case ExoPlayer.STATE_PREPARING: mIsPrepareing = true; break; case ExoPlayer.STATE_BUFFERING: notifyOnInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_START, mInternalPlayer.getBufferedPercentage()); mIsBuffering = true; break; case ExoPlayer.STATE_READY: break; case ExoPlayer.STATE_ENDED: notifyOnCompletion(); break; default: break; } }