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


Java MediaStatus.IDLE_REASON_CANCELED属性代码示例

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


在下文中一共展示了MediaStatus.IDLE_REASON_CANCELED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldRemoteUiBeVisible

/**
 * A helper method to determine if, given a player state and an idle reason (if the state is
 * idle) will warrant having a UI for remote presentation of the remote content.
 *
 * @throws TransientNetworkDisconnectionException
 * @throws NoConnectionException
 */
public boolean shouldRemoteUiBeVisible(int state, int idleReason)
        throws TransientNetworkDisconnectionException, NoConnectionException {
    switch (state) {
        case MediaStatus.PLAYER_STATE_PLAYING:
        case MediaStatus.PLAYER_STATE_PAUSED:
        case MediaStatus.PLAYER_STATE_BUFFERING:
            return true;
        case MediaStatus.PLAYER_STATE_IDLE:
            if (isRemoteStreamLive() && (idleReason == MediaStatus.IDLE_REASON_CANCELED)) {
                // we have a live stream and we have "stopped/paused" it
                return true;
            } else {
                // if we have not reached the end of queue, return true otherwise return false
                return mMediaStatus != null && (mMediaStatus.getLoadingItemId()
                        != MediaQueueItem.INVALID_ITEM_ID);
            }
        default:
    }
    return false;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:27,代码来源:VideoCastManager.java

示例2: shouldRemoteUiBeVisible

/**
 * A helper method to determine if, given a player state and an idle reason (if the state is
 * idle) will warrant having a UI for remote presentation of the remote content.
 *
 * @param state
 * @param idleReason
 * @return
 * @throws TransientNetworkDisconnectionException
 * @throws NoConnectionException
 */
public boolean shouldRemoteUiBeVisible(int state, int idleReason)
        throws TransientNetworkDisconnectionException,
        NoConnectionException {
    switch (state) {
        case MediaStatus.PLAYER_STATE_PLAYING:
        case MediaStatus.PLAYER_STATE_PAUSED:
        case MediaStatus.PLAYER_STATE_BUFFERING:
            return true;
        case MediaStatus.PLAYER_STATE_IDLE:
            if (!isRemoteStreamLive()) {
                return false;
            }
            return idleReason == MediaStatus.IDLE_REASON_CANCELED;
        default:
            break;
    }
    return false;
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:28,代码来源:VideoCastManager.java

示例3: shouldRemoteUiBeVisible

/**
 * A helper method to determine if, given a player state and an idle reason (if the state is
 * idle) will warrant having a UI for remote presentation of the remote content.
 *
 * @param state
 * @param idleReason
 * @return
 * @throws TransientNetworkDisconnectionException
 * @throws NoConnectionException
 */
public boolean shouldRemoteUiBeVisible(int state, int idleReason) throws TransientNetworkDisconnectionException, NoConnectionException {
  switch (state) {
    case MediaStatus.PLAYER_STATE_PLAYING:
    case MediaStatus.PLAYER_STATE_PAUSED:
    case MediaStatus.PLAYER_STATE_BUFFERING:
      return true;
    case MediaStatus.PLAYER_STATE_IDLE:
      if (!isRemoteStreamLive()) {
        return false;
      }
      return idleReason == MediaStatus.IDLE_REASON_CANCELED;
    default:
      break;
  }
  return false;
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:26,代码来源:VideoCastManager.java

示例4: togglePlayback

private void togglePlayback() throws CastException, TransientNetworkDisconnectionException, NoConnectionException {
  switch (mPlaybackState) {
    case MediaStatus.PLAYER_STATE_PAUSED:
      mCastManager.play();
      mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
      restartTrickplayTimer();
      break;
    case MediaStatus.PLAYER_STATE_PLAYING:
      mCastManager.pause();
      mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
      break;
    case MediaStatus.PLAYER_STATE_IDLE:
      if ((mSelectedMedia.getStreamType() == MediaInfo.STREAM_TYPE_LIVE) && (mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_CANCELED)) {
        mCastManager.play();
      } else {
        mCastManager.loadMedia(mSelectedMedia, true, 0);
      }
      mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
      restartTrickplayTimer();
      break;
    default:
      break;
  }
  mCastController.setPlaybackStatus(mPlaybackState);
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:25,代码来源:VideoCastControllerFragment.java

示例5: togglePlayback

private void togglePlayback() throws CastException, TransientNetworkDisconnectionException,
        NoConnectionException {
    switch (mPlaybackState) {
        case MediaStatus.PLAYER_STATE_PAUSED:
            mCastManager.play();
            //mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            restartTrickplayTimer();
            break;
        case MediaStatus.PLAYER_STATE_PLAYING:
            mCastManager.pause();
            //mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            break;
        case MediaStatus.PLAYER_STATE_IDLE:
            if ((mSelectedMedia.getStreamType() == MediaInfo.STREAM_TYPE_LIVE)
                    && (mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_CANCELED)) {
                mCastManager.play();
            } else {
                mCastManager.loadMedia(mSelectedMedia, true, 0);
            }
            //mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            restartTrickplayTimer();
            break;
        default:
            break;
    }
    mCastController.setPlaybackStatus(mPlaybackState);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:27,代码来源:VideoCastControllerFragment.java

示例6: togglePlayback

private void togglePlayback() throws CastException, TransientNetworkDisconnectionException,
        NoConnectionException {
    switch (mPlaybackState) {
        case MediaStatus.PLAYER_STATE_PAUSED:
            mCastManager.play();
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            restartTrickplayTimer();
            break;
        case MediaStatus.PLAYER_STATE_PLAYING:
            mCastManager.pause();
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            break;
        case MediaStatus.PLAYER_STATE_IDLE:
            if ((mSelectedMedia.getStreamType() == MediaInfo.STREAM_TYPE_LIVE)
                    && (mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_CANCELED)) {
                mCastManager.play();
            } else {
                mCastManager.loadMedia(mSelectedMedia, true, 0);
            }
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            restartTrickplayTimer();
            break;
        default:
            break;
    }
    mCastController.setPlaybackStatus(mPlaybackState);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:27,代码来源:VideoCastControllerFragment.java

示例7: onRemoteMediaPlayerStatusUpdated

@Override
//@DebugLog
public void onRemoteMediaPlayerStatusUpdated() {
    MediaStatus status = mCastManager.getRemoteMediaPlayer().getMediaStatus();
    int mState = status.getPlayerState();
    int mIdleReason = status.getIdleReason();
    if (mState == MediaStatus.PLAYER_STATE_PLAYING) {
        if (D) Log.d(TAG, "onRemoteMediaPlayerStatusUpdated(): Player status = playing");
        //HACK
        if (!mService.isSupposedToBePlaying()) {
            mService.setSupposedToBePlaying(true);
            mService.notifyChange(MusicPlaybackService.PLAYSTATE_CHANGED);
        }
    } else if (mState == MediaStatus.PLAYER_STATE_PAUSED) {
        if (D) Log.d(TAG, "onRemoteMediaPlayerStatusUpdated(): Player status = paused");
    } else if (mState == MediaStatus.PLAYER_STATE_IDLE) {
        if (D) Log.d(TAG, "onRemoteMediaPlayerStatusUpdated(): Player status = idle");
        if (mIdleReason == MediaStatus.IDLE_REASON_CANCELED) {
            if (D) Log.d(TAG, "onRemoteMediaPlayerStatusUpdated(): IDLE reason = CANCELLED");
            //TODO
        }
    } else if (mState == MediaStatus.PLAYER_STATE_BUFFERING) {
        if (D) Log.d(TAG, "onRemoteMediaPlayerStatusUpdated(): Player status = buffering");
    } else {
        if (D) Log.d(TAG, "onRemoteMediaPlayerStatusUpdated(): Player status = unknown");
    }
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:27,代码来源:MusicCastConsumer.java

示例8: setPlaybackStatus

@Override
public void setPlaybackStatus(int state, int idleReason) {
    mPlaybackState = state;
    mIdleReason = idleReason;
    mIcon.setVisibility(View.VISIBLE);
    //restore title
    if(state != ArchosMediaStatus.PLAYER_STATE_PREPARING&&mTitleText!=null){
        mTitle.setText(mTitleText);
    }
    switch (state) {
        case MediaStatus.PLAYER_STATE_PLAYING:
            if(!isFullVisible())
                mPlayPause.setVisibility(View.VISIBLE);
            mPlayPause.setImageDrawable(getPauseStopDrawable());
            mSecondaryPlayPause.setImageDrawable(getPauseStopDrawable());
            setLoadingVisibility(false);
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            if(!isFullVisible())
                mPlayPause.setVisibility(View.VISIBLE);
            mPlayPause.setImageDrawable(mPlayDrawable);
            mSecondaryPlayPause.setImageDrawable(mPlayDrawable);
            setLoadingVisibility(false);
            break;
        case MediaStatus.PLAYER_STATE_IDLE:
            switch (mStreamType) {
                case MediaInfo.STREAM_TYPE_BUFFERED:
                    mPlayPause.setVisibility(View.INVISIBLE);
                    setLoadingVisibility(false);
                    break;
                case MediaInfo.STREAM_TYPE_LIVE:
                    if (idleReason == MediaStatus.IDLE_REASON_CANCELED) {
                        if(!isFullVisible())
                            mPlayPause.setVisibility(View.VISIBLE);
                        mPlayPause.setImageDrawable(mPlayDrawable);
                        mSecondaryPlayPause.setImageDrawable(mPlayDrawable);
                        setLoadingVisibility(false);
                    } else {
                        mPlayPause.setVisibility(View.INVISIBLE);
                        setLoadingVisibility(false);
                    }
                    break;
            }
            break;
        case MediaStatus.PLAYER_STATE_BUFFERING:
            mPlayPause.setVisibility(View.INVISIBLE);
            setLoadingVisibility(true);
            break;
        case ArchosMediaStatus.PLAYER_STATE_PREPARING:
        case ArchosMediaStatus.PLAYER_STATE_SWITCHING:
            mIcon.setVisibility(View.INVISIBLE);
            mTitle.setText(R.string.loading);
            mPlayPause.setVisibility(View.INVISIBLE);
            setLoadingVisibility(true);
            break;
        default:
            mPlayPause.setVisibility(View.INVISIBLE);
            setLoadingVisibility(false);
            break;
    }
    updateRatioButton();
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:62,代码来源:ArchosMiniPlayer.java

示例9: updatePlayerStatus

private void updatePlayerStatus() {
    int mediaStatus = mCastManager.getPlaybackStatus();
    mMediaStatus = mCastManager.getMediaStatus();
    LOGD(TAG, "updatePlayerStatus(), state: " + mediaStatus);
    if (mSelectedMedia == null) {
        return;
    }
    mCastController.setStreamType(mSelectedMedia.getStreamType());
    if (mediaStatus == MediaStatus.PLAYER_STATE_BUFFERING) {
        mCastController.setSubTitle(getString(R.string.ccl_loading));
    } else {
        mCastController.setSubTitle(getString(R.string.ccl_casting_to_device,
                mCastManager.getDeviceName()));
    }
    switch (mediaStatus) {
        case MediaStatus.PLAYER_STATE_PLAYING:
            mIsFresh = false;
            if (mPlaybackState != MediaStatus.PLAYER_STATE_PLAYING) {
                mPlaybackState = MediaStatus.PLAYER_STATE_PLAYING;
                mCastController.setPlaybackStatus(mPlaybackState);
            }
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            mIsFresh = false;
            if (mPlaybackState != MediaStatus.PLAYER_STATE_PAUSED) {
                mPlaybackState = MediaStatus.PLAYER_STATE_PAUSED;
                mCastController.setPlaybackStatus(mPlaybackState);
            }
            break;
        case MediaStatus.PLAYER_STATE_BUFFERING:
            mIsFresh = false;
            if (mPlaybackState != MediaStatus.PLAYER_STATE_BUFFERING) {
                mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
                mCastController.setPlaybackStatus(mPlaybackState);
            }
            break;
        case MediaStatus.PLAYER_STATE_IDLE:
            LOGD(TAG, "Idle Reason: " + (mCastManager.getIdleReason()));
            switch (mCastManager.getIdleReason()) {
                case MediaStatus.IDLE_REASON_FINISHED:
                    if (!mIsFresh && (mMediaStatus==null||mMediaStatus.getLoadingItemId()
                            == MediaQueueItem.INVALID_ITEM_ID)) {
                        mCastController.closeActivity();
                    }
                    break;
                case MediaStatus.IDLE_REASON_CANCELED:
                    try {
                        if (mCastManager.isRemoteStreamLive()) {
                            if (mPlaybackState != MediaStatus.PLAYER_STATE_IDLE) {
                                mPlaybackState = MediaStatus.PLAYER_STATE_IDLE;
                                mCastController.setPlaybackStatus(mPlaybackState);
                            }
                        } else {
                            mCastController.closeActivity();
                        }
                    } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
                        LOGD(TAG, "Failed to determine if stream is live", e);
                    }
                    break;
                case MediaStatus.IDLE_REASON_INTERRUPTED:
                    mPlaybackState = MediaStatus.PLAYER_STATE_IDLE;
                    mCastController.setPlaybackStatus(mPlaybackState);
                    break;
                default:
                    break;
            }
            break;

        default:
            break;
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:72,代码来源:VideoCastControllerFragment.java

示例10: updatePlayPauseState

private void updatePlayPauseState(int state) {
    if (mPausePlay != null) {
        switch (state) {
            case MediaStatus.PLAYER_STATE_PLAYING:
                mPausePlay.setImageDrawable(getPauseStopDrawable());
                adjustControlsVisibility(true);
                break;
            case MediaStatus.PLAYER_STATE_PAUSED:
                mPausePlay.setImageDrawable(mPlayDrawable);
                adjustControlsVisibility(true);
                break;
            case MediaStatus.PLAYER_STATE_IDLE:
                mPausePlay.setVisibility(View.INVISIBLE);
                setLoadingVisibility(false);

                if (mState == MediaStatus.PLAYER_STATE_IDLE
                        && mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_FINISHED) {
                    hideControls(true, R.string.ccl_no_media_info);
                } else {
                    switch (mStreamType) {
                        case MediaInfo.STREAM_TYPE_BUFFERED:
                            mPausePlay.setVisibility(View.INVISIBLE);
                            setLoadingVisibility(false);
                            break;
                        case MediaInfo.STREAM_TYPE_LIVE:
                            int idleReason = mCastManager.getIdleReason();
                            if (idleReason == MediaStatus.IDLE_REASON_CANCELED) {
                                mPausePlay.setImageDrawable(mPlayDrawable);
                                adjustControlsVisibility(true);
                            } else {
                                mPausePlay.setVisibility(View.INVISIBLE);
                                setLoadingVisibility(false);
                            }
                            break;
                    }
                }
                break;
            case MediaStatus.PLAYER_STATE_BUFFERING:
                adjustControlsVisibility(false);
                break;
            default:
                mPausePlay.setVisibility(View.INVISIBLE);
                setLoadingVisibility(false);
        }
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:46,代码来源:VideoMediaRouteControllerDialog.java

示例11: updatePlayerStatus

private void updatePlayerStatus() {
    int mediaStatus = mCastManager.getPlaybackStatus();
    mMediaStatus = mCastManager.getMediaStatus();
    LOGD(TAG, "updatePlayerStatus(), state: " + mediaStatus);
    if (mSelectedMedia == null) {
        return;
    }
    mCastController.setStreamType(mSelectedMedia.getStreamType());
    if (mediaStatus == MediaStatus.PLAYER_STATE_BUFFERING) {
        mCastController.setSubTitle(getString(R.string.ccl_loading));
    } else {
        mCastController.setSubTitle(getString(R.string.ccl_casting_to_device,
                mCastManager.getDeviceName()));
    }
    switch (mediaStatus) {
        case MediaStatus.PLAYER_STATE_PLAYING:
            mIsFresh = false;
            if (mPlaybackState != MediaStatus.PLAYER_STATE_PLAYING) {
                mPlaybackState = MediaStatus.PLAYER_STATE_PLAYING;
                mCastController.setPlaybackStatus(mPlaybackState);
            }
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            mIsFresh = false;
            if (mPlaybackState != MediaStatus.PLAYER_STATE_PAUSED) {
                mPlaybackState = MediaStatus.PLAYER_STATE_PAUSED;
                mCastController.setPlaybackStatus(mPlaybackState);
            }
            break;
        case MediaStatus.PLAYER_STATE_BUFFERING:
            mIsFresh = false;
            if (mPlaybackState != MediaStatus.PLAYER_STATE_BUFFERING) {
                mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
                mCastController.setPlaybackStatus(mPlaybackState);
            }
            break;
        case MediaStatus.PLAYER_STATE_IDLE:
            LOGD(TAG, "Idle Reason: " + (mCastManager.getIdleReason()));
            switch (mCastManager.getIdleReason()) {
                case MediaStatus.IDLE_REASON_FINISHED:
                    if (!mIsFresh && (mMediaStatus == null || mMediaStatus.getLoadingItemId()
                            == MediaQueueItem.INVALID_ITEM_ID)) {
                        mCastController.closeActivity();
                    }
                    break;
                case MediaStatus.IDLE_REASON_CANCELED:
                    try {
                        if (mCastManager.isRemoteStreamLive()) {
                            if (mPlaybackState != MediaStatus.PLAYER_STATE_IDLE) {
                                mPlaybackState = MediaStatus.PLAYER_STATE_IDLE;
                                mCastController.setPlaybackStatus(mPlaybackState);
                            }
                        } else {
                            mCastController.closeActivity();
                        }
                    } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
                        LOGD(TAG, "Failed to determine if stream is live", e);
                    }
                    break;
                case MediaStatus.IDLE_REASON_INTERRUPTED:
                    mPlaybackState = MediaStatus.PLAYER_STATE_IDLE;
                    mCastController.setPlaybackStatus(mPlaybackState);
                    break;
                default:
                    break;
            }
            break;

        default:
            break;
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:72,代码来源:VideoCastControllerFragment.java

示例12: setPlaybackStatus

@Override
public void setPlaybackStatus(int state, int idleReason) {
    switch (state) {
        case MediaStatus.PLAYER_STATE_PLAYING:
            mPlayPause.setVisibility(View.VISIBLE);
            mPlayPause.setImageDrawable(getPauseStopDrawable());
            setLoadingVisibility(false);
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            mPlayPause.setVisibility(View.VISIBLE);
            mPlayPause.setImageDrawable(mPlayDrawable);
            setLoadingVisibility(false);
            break;
        case MediaStatus.PLAYER_STATE_IDLE:
            switch (mStreamType) {
                case MediaInfo.STREAM_TYPE_BUFFERED:
                    mPlayPause.setVisibility(View.INVISIBLE);
                    setLoadingVisibility(false);
                    break;
                case MediaInfo.STREAM_TYPE_LIVE:
                    if (idleReason == MediaStatus.IDLE_REASON_CANCELED) {
                        mPlayPause.setVisibility(View.VISIBLE);
                        mPlayPause.setImageDrawable(mPlayDrawable);
                        setLoadingVisibility(false);
                    } else {
                        mPlayPause.setVisibility(View.INVISIBLE);
                        setLoadingVisibility(false);
                    }
                    break;
            }
            break;
        case MediaStatus.PLAYER_STATE_BUFFERING:
            mPlayPause.setVisibility(View.INVISIBLE);
            setLoadingVisibility(true);
            break;
        default:
            mPlayPause.setVisibility(View.INVISIBLE);
            setLoadingVisibility(false);
            break;
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:41,代码来源:MiniController.java

示例13: updatePlaybackState

void updatePlaybackState() {
    final int status = VideoCastManager.getInstance().getPlaybackStatus();

    // Convert the remote playback states to media playback states.
    switch (status) {
        case MediaStatus.PLAYER_STATE_IDLE:
            final int idleReason = VideoCastManager.getInstance().getIdleReason();
            switch (idleReason) {
                case MediaStatus.IDLE_REASON_ERROR:
                    if (mCallback != null)
                        mCallback.onError(new Exception("Error: " + idleReason), true);
                    break;
                case MediaStatus.IDLE_REASON_INTERRUPTED:
                case MediaStatus.IDLE_REASON_CANCELED:
                    // TODO: What should happen here?
                    mState = PlaybackStateCompat.STATE_NONE;
                    if (mCallback != null)
                        mCallback.onPlaybackStatusChanged(mState);
                    break;
                case MediaStatus.IDLE_REASON_FINISHED:
                    if (mCallback != null)
                        mCallback.onCompletion();
                    break;
                default:
                    setMetadataFromRemote();
                    if (mCallback != null)
                        mCallback.onPlaybackStatusChanged(mState);
                    break;
            }
            break;
        case MediaStatus.PLAYER_STATE_BUFFERING:
            mState = PlaybackStateCompat.STATE_BUFFERING;
            setMetadataFromRemote();
            if (mCallback != null)
                mCallback.onPlaybackStatusChanged(mState);
            break;
        case MediaStatus.PLAYER_STATE_PLAYING:
            mState = PlaybackStateCompat.STATE_PLAYING;
            setMetadataFromRemote();
            if (mCallback != null)
                mCallback.onPlaybackStatusChanged(mState);
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            mState = PlaybackStateCompat.STATE_PAUSED;
            setMetadataFromRemote();
            if (mCallback != null)
                mCallback.onPlaybackStatusChanged(mState);
            break;
        default: // case unknown
            setMetadataFromRemote();
            if (mCallback != null)
                mCallback.onPlaybackStatusChanged(mState);
            break;
    }
}
 
开发者ID:lifechurch,项目名称:nuclei-android,代码行数:55,代码来源:CastPlayback.java

示例14: updatePlayPauseState

private void updatePlayPauseState(int state) {
    if (null != mPausePlay) {
        switch (state) {
            case MediaStatus.PLAYER_STATE_PLAYING:
                mPausePlay.setImageDrawable(getPauseStopButton());
                adjustControlsVisibility(true);
                break;
            case MediaStatus.PLAYER_STATE_PAUSED:
                mPausePlay.setImageDrawable(mPlayDrawable);
                adjustControlsVisibility(true);
                break;
            case MediaStatus.PLAYER_STATE_IDLE:
                mPausePlay.setVisibility(View.INVISIBLE);
                setLoadingVisibility(false);

                if (mState == MediaStatus.PLAYER_STATE_IDLE
                        && mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_FINISHED) {
                    hideControls(true, R.string.no_media_info);
                } else {
                    switch (mStreamType) {
                        case MediaInfo.STREAM_TYPE_BUFFERED:
                            mPausePlay.setVisibility(View.INVISIBLE);
                            setLoadingVisibility(false);
                            break;
                        case MediaInfo.STREAM_TYPE_LIVE:
                            int idleReason = mCastManager.getIdleReason();
                            if (idleReason == MediaStatus.IDLE_REASON_CANCELED) {
                                mPausePlay.setImageDrawable(mPlayDrawable);
                                adjustControlsVisibility(true);
                            } else {
                                mPausePlay.setVisibility(View.INVISIBLE);
                                setLoadingVisibility(false);
                            }
                            break;
                    }
                }
                break;
            case MediaStatus.PLAYER_STATE_BUFFERING:
                adjustControlsVisibility(false);
                break;
            default:
                mPausePlay.setVisibility(View.INVISIBLE);
                setLoadingVisibility(false);
        }
    }
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:46,代码来源:VideoMediaRouteControllerDialog.java

示例15: setPlaybackStatus

@Override
public void setPlaybackStatus(int state, int idleReason) {
    switch (state) {
        case MediaStatus.PLAYER_STATE_PLAYING:
            mPlayPause.setVisibility(View.VISIBLE);
            mPlayPause.setImageDrawable(getPauseStopButton());
            setLoadingVisibility(false);
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            mPlayPause.setVisibility(View.VISIBLE);
            mPlayPause.setImageDrawable(mPlayDrawable);
            setLoadingVisibility(false);
            break;
        case MediaStatus.PLAYER_STATE_IDLE:
            switch (mStreamType) {
                case MediaInfo.STREAM_TYPE_BUFFERED:
                    mPlayPause.setVisibility(View.INVISIBLE);
                    setLoadingVisibility(false);
                    break;
                case MediaInfo.STREAM_TYPE_LIVE:
                    if (idleReason == MediaStatus.IDLE_REASON_CANCELED) {
                        mPlayPause.setVisibility(View.VISIBLE);
                        mPlayPause.setImageDrawable(mPlayDrawable);
                        setLoadingVisibility(false);
                    } else {
                        mPlayPause.setVisibility(View.INVISIBLE);
                        setLoadingVisibility(false);
                    }
                    break;
            }
            break;
        case MediaStatus.PLAYER_STATE_BUFFERING:
            mPlayPause.setVisibility(View.INVISIBLE);
            setLoadingVisibility(true);
            break;
        default:
            mPlayPause.setVisibility(View.INVISIBLE);
            setLoadingVisibility(false);
            break;
    }
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:41,代码来源:MiniController.java


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