當前位置: 首頁>>代碼示例>>Java>>正文


Java ExoPlayer.STATE_ENDED屬性代碼示例

本文整理匯總了Java中com.google.android.exoplayer2.ExoPlayer.STATE_ENDED屬性的典型用法代碼示例。如果您正苦於以下問題:Java ExoPlayer.STATE_ENDED屬性的具體用法?Java ExoPlayer.STATE_ENDED怎麽用?Java ExoPlayer.STATE_ENDED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.android.exoplayer2.ExoPlayer的用法示例。


在下文中一共展示了ExoPlayer.STATE_ENDED屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startPlayback

private void startPlayback() {
    if (player != null) {
        switch (player.getPlaybackState()) {
            case ExoPlayer.STATE_IDLE:
            case ExoPlayer.STATE_ENDED:
                initializePlayer();
                break;
            case ExoPlayer.STATE_BUFFERING:
            case ExoPlayer.STATE_READY:
                if (!player.getPlayWhenReady()) {
                    setPlayWhenReady(true);
                }
                break;
            default:
                break;
        }

    } else {
        initializePlayer();
    }
    if (!disableFocus) {
        setKeepScreenOn(true);
    }
}
 
開發者ID:12d,項目名稱:react-native-videoplayer,代碼行數:24,代碼來源:ReactExoplayerView.java

示例2: onPlayerStateChanged

@Override
public final void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
  Log.d(tag, "state [" + playWhenReady + ", " + playbackState + "]");
  playerWasPrepared |= playbackState != ExoPlayer.STATE_IDLE;
  if (playbackState == ExoPlayer.STATE_ENDED
      || (playbackState == ExoPlayer.STATE_IDLE && playerWasPrepared)) {
    playerFinished = true;
  }
  boolean playing = playWhenReady && playbackState == ExoPlayer.STATE_READY;
  if (!this.playing && playing) {
    lastPlayingStartTimeMs = SystemClock.elapsedRealtime();
  } else if (this.playing && !playing) {
    totalPlayingTimeMs += SystemClock.elapsedRealtime() - lastPlayingStartTimeMs;
  }
  this.playing = playing;
}
 
開發者ID:ashwanijanghu,項目名稱:ExoPlayer-Offline,代碼行數:16,代碼來源:ExoHostedTest.java

示例3: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean b, int i) {
    Log.e("ExoMedia", "onPlayerStateChanged " + b + i);

    if (i == ExoPlayer.STATE_READY) {
        if (!isPrepar) {
            isPrepar = true;
            iMediaCallback.onPrepared(this);//第一次初始化
        }
        //緩衝好了
        iMediaCallback.onInfo(this, MEDIA_INFO_BUFFERING_END, MEDIA_INFO_BUFFERING_END);
        mainThreadHandler.removeCallbacks(runnable);
        mainThreadHandler.post(runnable);
    }
    //播放完畢
    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);

}
 
開發者ID:tohodog,項目名稱:QSVideoPlayer,代碼行數:23,代碼來源:ExoMedia.java

示例4: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    switch (playbackState) {

        case ExoPlayer.STATE_ENDED:
            //Log.d(TAG, "player state -> STATE_ENDED");
            mPlayer.stop();
            break;

        case ExoPlayer.STATE_IDLE:
            //Log.d(TAG, "player state -> STATE_IDLE");
            break;

        case ExoPlayer.STATE_READY:
            //Log.d(TAG, "player state -> STATE_READY");
            break;

        case ExoPlayer.STATE_BUFFERING:
           // Log.d(TAG, "player state -> STATE_BUFFERING");
            break;
        default:

            break;
    }
}
 
開發者ID:hiliving,項目名稱:P2Video-master,代碼行數:25,代碼來源:PlayerActivity.java

示例5: onClick

@Override
public void onClick(View v) {
    if (v == playView && player != null) {
        if (player.getPlaybackState() == ExoPlayer.STATE_ENDED) {
            player.seekTo(0);
            player.setPlayWhenReady(true);
        } else {
            player.setPlayWhenReady(!player.getPlayWhenReady());
        }
    } else if (v == fullscreen) {
        Intent playerIntent = new Intent(getContext(), VideoPlayerActivity.class);
        playerIntent.putExtra("uri", uri);
        playerIntent.putExtra("position", player.getCurrentPosition());
        playerIntent.putExtra("windowIndex", player.getCurrentWindowIndex());
        playerIntent.putExtra("rotation", getWidth() > getHeight());
        getContext().startActivity(playerIntent);
        disconnect();
        playerInstance.startFullScreenMode();
    } else if (v == videoView) {
        if (isConnected) {
            show();
        } else {
            connect();
        }
    }
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:26,代碼來源:CommonExoPlayerView.java

示例6: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    switch (playbackState) {
        case ExoPlayer.STATE_BUFFERING:
        case ExoPlayer.STATE_READY:
            replayImageButton.setVisibility(View.GONE);
            exoButtonsFrameLayout.setVisibility(View.VISIBLE);
            break;
        case ExoPlayer.STATE_ENDED:
            exoButtonsFrameLayout.setVisibility(View.GONE);
            replayImageButton.setVisibility(View.VISIBLE);
            break;
        default:
            break;
    }
}
 
開發者ID:SalmanTKhan,項目名稱:MyAnimeViewer,代碼行數:16,代碼來源:VideoDetailsFragment.java

示例7: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    switch (playbackState) {
        case ExoPlayer.STATE_BUFFERING:
            replayImageButton.setVisibility(View.GONE);
            exoButtonsFrameLayout.setVisibility(View.VISIBLE);
            break;
        case ExoPlayer.STATE_READY:
            replayImageButton.setVisibility(View.GONE);
            exoButtonsFrameLayout.setVisibility(View.VISIBLE);
            break;
        case ExoPlayer.STATE_ENDED:
            exoButtonsFrameLayout.setVisibility(View.GONE);
            replayImageButton.setVisibility(View.VISIBLE);
            break;
        default:
            break;
    }
}
 
開發者ID:SalmanTKhan,項目名稱:MyAnimeViewer,代碼行數:19,代碼來源:VideoPlayerActivity.java

示例8: onPlayerStateChanged

@Override
public void onPlayerStateChanged(final boolean playWhenReady, final int playbackState) {
    if (Log.logDEnabled()) {
        Log.d(TAG, "onPlayerStateChanged: " + playbackState);
    }
    if (mMediaPlayerListener != null) {
        switch (playbackState) {
            case ExoPlayer.STATE_READY:
                mLoadedMediaUri = mLoadingMediaUri;
                if (playWhenReady) {
                    mMediaPlayerListener.onPlaybackStarted();
                } else {
                    mMediaPlayerListener.onPlaybackPaused();
                }
                break;

            case ExoPlayer.STATE_ENDED:
                mMediaPlayerListener.onPlaybackFinished();
                break;
        }
    }
}
 
開發者ID:Doctoror,項目名稱:PainlessMusicPlayer,代碼行數:22,代碼來源:ExoMediaPlayer.java

示例9: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState)
{
    switch (playbackState) {
        case ExoPlayer.STATE_IDLE:
        case ExoPlayer.STATE_BUFFERING:
        case ExoPlayer.STATE_READY:
            if (callback != null) {
                callback.onPlaybackStatusChanged(getState());
            }
            break;
        case ExoPlayer.STATE_ENDED:
            // The media player finished playing the current song.
            if (callback != null) {
                callback.onCompletion();
            }
            break;
    }
}
 
開發者ID:teocci,項目名稱:YouTube-In-Background,代碼行數:19,代碼來源:LocalPlayback.java

示例10: getPlayerStateString

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;
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:21,代碼來源:DebugTextViewHelper.java

示例11: getState

@Override
public int getState() {
    if (mExoPlayer == null) {
        return mExoPlayerNullIsStopped
                ? PlaybackStateCompat.STATE_STOPPED
                : PlaybackStateCompat.STATE_NONE;
    }
    switch (mExoPlayer.getPlaybackState()) {
        case ExoPlayer.STATE_IDLE:
            return PlaybackStateCompat.STATE_PAUSED;
        case ExoPlayer.STATE_BUFFERING:
            return PlaybackStateCompat.STATE_BUFFERING;
        case ExoPlayer.STATE_READY:
            return mExoPlayer.getPlayWhenReady()
                    ? PlaybackStateCompat.STATE_PLAYING
                    : PlaybackStateCompat.STATE_PAUSED;
        case ExoPlayer.STATE_ENDED:
            return PlaybackStateCompat.STATE_PAUSED;
        default:
            return PlaybackStateCompat.STATE_NONE;
    }
}
 
開發者ID:googlesamples,項目名稱:android-UniversalMusicPlayer,代碼行數:22,代碼來源:LocalPlayback.java

示例12: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    switch (playbackState) {
        case ExoPlayer.STATE_IDLE:
        case ExoPlayer.STATE_BUFFERING:
        case ExoPlayer.STATE_READY:
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(getState());
            }
            break;
        case ExoPlayer.STATE_ENDED:
            // The media player finished playing the current song.
            if (mCallback != null) {
                mCallback.onCompletion();
            }
            break;
    }
}
 
開發者ID:googlesamples,項目名稱:android-UniversalMusicPlayer,代碼行數:18,代碼來源:LocalPlayback.java

示例13: onPlayerStateChanged

/************************
 * ExoPlayer2.Listener
 ************************/
@Override
public void onPlayerStateChanged(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_READY:
            onVideoLoaded();
            text += "ready";
            break;
        default:
            text += "unknown";
            break;
    }
    Log.d(TAG, "onStateChanged: " + text);
}
 
開發者ID:evercam,項目名稱:evercam-android,代碼行數:27,代碼來源:VideoActivity.java

示例14: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    String text = "onStateChanged: playWhenReady=" + playWhenReady + ", playbackState=";
    switch (playbackState) {
        case ExoPlayer.STATE_IDLE:
            text += "idle";
            eventEmitter.idle();
            break;
        case ExoPlayer.STATE_BUFFERING:
            text += "buffering";
            onBuffering(true);
            break;
        case ExoPlayer.STATE_READY:
            text += "ready";
            eventEmitter.ready();
            onBuffering(false);
            startProgressHandler();
            videoLoaded();
            break;
        case ExoPlayer.STATE_ENDED:
            text += "ended";
            eventEmitter.end();
            onStopPlayback();
            break;
        default:
            text += "unknown";
            break;
    }
    Log.d(TAG, text);
}
 
開發者ID:12d,項目名稱:react-native-videoplayer,代碼行數:30,代碼來源:ReactExoplayerView.java

示例15: maybeShowController

private void maybeShowController(boolean isForced) {
    if (!useController || player == null) {
        return;
    }
    int playbackState = player.getPlaybackState();
    boolean showIndefinitely = playbackState == ExoPlayer.STATE_IDLE
            || playbackState == ExoPlayer.STATE_ENDED || !player.getPlayWhenReady();
    boolean wasShowingIndefinitely = controller.isVisible() && controller.getShowTimeoutMs() <= 0;
    controller.setShowTimeoutMs(showIndefinitely ? 0 : controllerShowTimeoutMs);
    if (isForced || showIndefinitely || wasShowingIndefinitely) {
        controller.show();
    }
}
 
開發者ID:Tubitv,項目名稱:TubiPlayer,代碼行數:13,代碼來源:TubiExoPlayerView.java


注:本文中的com.google.android.exoplayer2.ExoPlayer.STATE_ENDED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。