Java Code Examples for com.google.android.exoplayer.ExoPlayer#STATE_READY
The following examples show how to use
com.google.android.exoplayer.ExoPlayer#STATE_READY .
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: 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 2
Source File: EventLogger.java From Android-Example-HLS-ExoPlayer 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 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 5
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 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: ExVidPlayerImp.java From ExVidPlayer with Apache License 2.0 | 6 votes |
@Override public void run() { switch (player.getPlaybackState()) { case ExoPlayer.STATE_BUFFERING: mlistener.onBuffering(playerControl.getBufferPercentage() + ""); break; case ExoPlayer.STATE_ENDED: mlistener.onCompletion(); break; case ExoPlayer.STATE_IDLE: break; case ExoPlayer.STATE_PREPARING: mlistener.onBufferingStarted(); break; case ExoPlayer.STATE_READY: mlistener.onBufferingFinished(); break; default: break; } mlistener.onProgressChanged((int) player.getCurrentPosition()); mainHandler.postDelayed(updatePlayer, 200); }
Example 8
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 9
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 10
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 11
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 12
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 13
Source File: PlayerActivity.java From android-tv-leanback with Apache License 2.0 | 5 votes |
@Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { Log.d(TAG, "player state " + playbackState); if (playbackState == ExoPlayer.STATE_READY) { shutterView.setVisibility(View.GONE); mediaController.show(0); } }
Example 14
Source File: DemoPlayer.java From androidtv-sample-inputs with Apache License 2.0 | 5 votes |
@Override public void onPlayerStateChanged(boolean playWhenReady, int state) { for (Callback tvCallback : mTvPlayerCallbacks) { if (playWhenReady && state == ExoPlayer.STATE_ENDED) { tvCallback.onCompleted(); } else if (playWhenReady && state == ExoPlayer.STATE_READY) { tvCallback.onStarted(); } } maybeReportPlayerState(); }
Example 15
Source File: PlayerActivity.java From android-tv-leanback with Apache License 2.0 | 5 votes |
@Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { Log.d(TAG, "player state " + playbackState); if (playbackState == ExoPlayer.STATE_READY) { shutterView.setVisibility(View.GONE); mediaController.show(0); } }
Example 16
Source File: PlayerActivity.java From android-tv-leanback with Apache License 2.0 | 5 votes |
@Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { Log.d(TAG, "player state " + playbackState); if (playbackState == ExoPlayer.STATE_READY) { shutterView.setVisibility(View.GONE); mediaController.show(0); } }
Example 17
Source File: PlayerActivity.java From android-tv-leanback with Apache License 2.0 | 5 votes |
@Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { Log.d(TAG, "player state " + playbackState); if (playbackState == ExoPlayer.STATE_READY) { shutterView.setVisibility(View.GONE); mediaController.show(0); } }
Example 18
Source File: PlayerActivity.java From android-tv-leanback with Apache License 2.0 | 5 votes |
@Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { Log.d(TAG, "player state " + playbackState); if (playbackState == ExoPlayer.STATE_READY) { shutterView.setVisibility(View.GONE); mediaController.show(0); } }
Example 19
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; } }
Example 20
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; } }