当前位置: 首页>>代码示例>>Java>>正文


Java MediaSessionStatus.SESSION_STATE_ENDED属性代码示例

本文整理汇总了Java中android.support.v7.media.MediaSessionStatus.SESSION_STATE_ENDED属性的典型用法代码示例。如果您正苦于以下问题:Java MediaSessionStatus.SESSION_STATE_ENDED属性的具体用法?Java MediaSessionStatus.SESSION_STATE_ENDED怎么用?Java MediaSessionStatus.SESSION_STATE_ENDED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.support.v7.media.MediaSessionStatus的用法示例。


在下文中一共展示了MediaSessionStatus.SESSION_STATE_ENDED属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:49,代码来源:MrpCastPlayerActivity.java


注:本文中的android.support.v7.media.MediaSessionStatus.SESSION_STATE_ENDED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。