Java Code Examples for com.google.android.exoplayer.ExoPlayer#STATE_PREPARING
The following examples show how to use
com.google.android.exoplayer.ExoPlayer#STATE_PREPARING .
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 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 3
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 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: 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 6
Source File: IjkExoMediaPlayer.java From talk-android with MIT License | 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 7
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 8
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 9
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 10
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 11
Source File: DemoPlayer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
public int getPlaybackState() { if (rendererBuildingState == RENDERER_BUILDING_STATE_BUILDING) { return ExoPlayer.STATE_PREPARING; } int playerState = player.getPlaybackState(); if (rendererBuildingState == RENDERER_BUILDING_STATE_BUILT && rendererBuildingState == RENDERER_BUILDING_STATE_IDLE) { // This is an edge case where the renderers are built, but are still being passed to the // player's playback thread. return ExoPlayer.STATE_PREPARING; } return playerState; }
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: 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 14
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 15
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 16
Source File: ExoplayerWrapper.java From google-media-framework-android with Apache License 2.0 | 5 votes |
/** * Returns the state of the Exoplayer instance. */ public int getPlaybackState() { if (rendererBuildingState == RENDERER_BUILDING_STATE_BUILDING) { return ExoPlayer.STATE_PREPARING; } int playerState = player.getPlaybackState(); if (rendererBuildingState == RENDERER_BUILDING_STATE_BUILT && rendererBuildingState == RENDERER_BUILDING_STATE_IDLE) { // This is an edge case where the renderers are built, but are still being passed to the // player's playback thread. return ExoPlayer.STATE_PREPARING; } return playerState; }
Example 17
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 18
Source File: VideoPlayerService.java From Mobilyzer with Apache License 2.0 | 5 votes |
@Override public void onStateChanged(boolean playWhenReady, int 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.e("", text); if (playbackState == ExoPlayer.STATE_ENDED) { Log.e("", "Playback ended!"); releasePlayer(true); this.stopSelf(); } // playerStateTextView.setText(text); }
Example 19
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 20
Source File: TvInputPlayer.java From ChannelSurfer with MIT License | 4 votes |
private static boolean isPlayerPrepared(ExoPlayer player) { int state = player.getPlaybackState(); return state != ExoPlayer.STATE_PREPARING && state != ExoPlayer.STATE_IDLE; }