本文整理汇总了Java中android.support.v7.media.MediaSessionStatus.SESSION_STATE_ACTIVE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaSessionStatus.SESSION_STATE_ACTIVE属性的具体用法?Java MediaSessionStatus.SESSION_STATE_ACTIVE怎么用?Java MediaSessionStatus.SESSION_STATE_ACTIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v7.media.MediaSessionStatus
的用法示例。
在下文中一共展示了MediaSessionStatus.SESSION_STATE_ACTIVE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processSessionStatusBundle
private void processSessionStatusBundle(Bundle statusBundle) {
MediaSessionStatus status = MediaSessionStatus.fromBundle(
statusBundle.getBundle(MediaControlIntent.EXTRA_SESSION_STATUS));
int sessionState = status.getSessionState();
// If no change do nothing
if (sessionState == mSessionState) return;
mSessionState = sessionState;
switch (sessionState) {
case MediaSessionStatus.SESSION_STATE_ACTIVE:
if (mLocalVideoUri != null) {
startPlayback(mPreferredTitle, mStartPositionMillis);
}
break;
case MediaSessionStatus.SESSION_STATE_ENDED:
case MediaSessionStatus.SESSION_STATE_INVALIDATED:
for (UiListener listener : getUiListeners()) {
listener.onPlaybackStateChanged(PlayerState.INVALIDATED);
}
if (getMediaStateListener() != null) {
getMediaStateListener().onPlaybackStateChanged(PlayerState.INVALIDATED);
}
// Record the remaining time UMA first, otherwise the playback state will be cleared
// in release().
recordRemainingTimeUMA();
// Set the current session id to null so we don't send the stop intent.
mCurrentSessionId = null;
release();
break;
default:
break;
}
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:36,代码来源:DefaultMediaRouteController.java
示例2: getSessionStatus
MediaSessionStatus getSessionStatus(String sid) {
int sessionState = (sid != null && sid.equals(mSessionId)) ?
MediaSessionStatus.SESSION_STATE_ACTIVE :
MediaSessionStatus.SESSION_STATE_INVALIDATED;
return new MediaSessionStatus.Builder(sessionState)
.setQueuePaused(mPaused)
.build();
}
示例3: processSessionStatusBundle
private void processSessionStatusBundle(Bundle statusBundle) {
Log.d(TAG, "processSessionStatusBundle()");
String sessionId = statusBundle.getString(MediaControlIntent.EXTRA_SESSION_ID);
MediaSessionStatus status = MediaSessionStatus.fromBundle(
statusBundle.getBundle(MediaControlIntent.EXTRA_SESSION_STATUS));
int sessionState = status.getSessionState();
Log.d(TAG, "got a session status update for session " + sessionId + ", state = "
+ sessionState + ", mSessionId=" + mSessionId);
if (mSessionId == null) {
return;
}
if (!mSessionId.equals(sessionId)) {
// Got status on a session other than the one we're tracking. Ignore it.
Log.d(TAG, "Received status for unknown session: " + sessionId);
return;
}
switch (sessionState) {
case MediaSessionStatus.SESSION_STATE_ACTIVE:
Log.d(TAG, "session " + sessionId + " is ACTIVE");
mSessionActive = true;
syncStatus();
break;
case MediaSessionStatus.SESSION_STATE_ENDED:
Log.d(TAG, "session " + sessionId + " is ENDED");
mSessionId = null;
mSessionActive = false;
clearCurrentMediaItem();
break;
case MediaSessionStatus.SESSION_STATE_INVALIDATED:
Log.d(TAG, "session " + sessionId + " is INVALIDATED");
mSessionId = null;
mSessionActive = false;
clearCurrentMediaItem();
break;
default:
Log.d(TAG, "Received unexpected session state: " + sessionState);
break;
}
updateButtonStates();
}