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


Java MediaStatus.IDLE_REASON_FINISHED属性代码示例

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


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

示例1: togglePlayback

/**
 * Toggles the playback of the movie.
 *
 * @throws CastException
 * @throws NoConnectionException
 * @throws TransientNetworkDisconnectionException
 */
public void togglePlayback() throws CastException, TransientNetworkDisconnectionException,
        NoConnectionException {
    checkConnectivity();
    boolean isPlaying = isRemoteMediaPlaying();
    if (isPlaying) {
        pause();
    } else {
        if (mState == MediaStatus.PLAYER_STATE_IDLE
                && mIdleReason == MediaStatus.IDLE_REASON_FINISHED) {
            loadMedia(getRemoteMediaInformation(), true, 0);
        } else {
            play();
        }
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:22,代码来源:VideoCastManager.java

示例2: togglePlayback

/**
 * Toggles the playback of the movie.
 *
 * @throws CastException
 * @throws NoConnectionException
 * @throws TransientNetworkDisconnectionException
 */
public void togglePlayback() throws CastException, TransientNetworkDisconnectionException,
        NoConnectionException {
    checkConnectivity();
    boolean isPlaying = isRemoteMoviePlaying();
    if (isPlaying) {
        pause();
    } else {
        if (mState == MediaStatus.PLAYER_STATE_IDLE
                && mIdleReason == MediaStatus.IDLE_REASON_FINISHED) {
            loadMedia(getRemoteMediaInformation(), true, 0);
        } else {
            play();
        }
    }
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:22,代码来源:VideoCastManager.java

示例3: onRemoteMediaPlayerStatusUpdated

@Override
public void onRemoteMediaPlayerStatusUpdated() {
    MediaStatus status = mCastManager.getRemoteMediaPlayer().getMediaStatus();
    int mState = status.getPlayerState();
    int mIdleReason = status.getIdleReason();
    switch (mState) {
        case MediaStatus.PLAYER_STATE_IDLE:
            if (mIdleReason == MediaStatus.IDLE_REASON_FINISHED) {
                loadRemoteNext();
            } else if (mIdleReason == MediaStatus.IDLE_REASON_ERROR) {
                // something bad happened on the cast device
                Log.e(TAG, "onRemoteMediaPlayerStatusUpdated(): IDLE reason = ERROR");
                mCastManager.onFailed(R.string.failed_receiver_player_error, -1);
            }
            break;
    }
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:17,代码来源:CastMusicPlayer.java

示例4: onResume

@Override
public void onResume() {
  CastUtils.LOGD(TAG, "onResume() was called");
  try {
    mCastManager = VideoCastManager.getInstance(getActivity());
    boolean shouldFinish = !mCastManager.isConnected() || (mCastManager.getPlaybackStatus() == MediaStatus.PLAYER_STATE_IDLE && mCastManager
        .getIdleReason() == MediaStatus.IDLE_REASON_FINISHED && !mIsFresh);
    if (shouldFinish) {
      mCastController.closeActivity();
    }
    mCastManager.addVideoCastConsumer(mCastConsumer);
    updatePlayerStatus();
    mIsFresh = false;
    mCastManager.incrementUiCounter();
  } catch (CastException e) {
    // logged already
  }
  super.onResume();
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:19,代码来源:VideoCastControllerFragment.java

示例5: onResume

@Override
public void onResume() {
    LOGD(TAG, "onResume() was called");
    try {
        mCastManager = VideoCastManager.getInstance(getActivity());
        boolean shouldFinish = !mCastManager.isConnected()
                || (mCastManager.getPlaybackStatus() == MediaStatus.PLAYER_STATE_IDLE
                && mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_FINISHED
                && !mIsFresh);
        if (shouldFinish) {
            mCastController.closeActivity();
        }
        mCastManager.addVideoCastConsumer(mCastConsumer);
        mCastManager.incrementUiCounter();
        if (!mIsFresh) updatePlayerStatus();
    } catch (CastException e) {
        // logged already
    }
    super.onResume();
}
 
开发者ID:TByron,项目名称:Jupiter-Broadcasting-Holo,代码行数:20,代码来源:VideoCastControllerFragment.java

示例6: getIdleReason

public int getIdleReason() {

        if(mIsSwitching||mIsRemoteDisplayConnected)
            return MediaStatus.IDLE_REASON_INTERRUPTED;
        else if(mCastManager.isConnected())
            return mCastManager.getIdleReason();
        return MediaStatus.IDLE_REASON_FINISHED;
    }
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:8,代码来源:ArchosVideoCastManager.java

示例7: onResume

@Override
public void onResume() {
    super.onResume();
    try {
        if (mCastManager.isRemoteMediaPaused() || mCastManager.isRemoteMediaPlaying()) {
            if (mCastManager.getRemoteMediaInformation() != null && mSelectedMedia
                    .getContentId().equals(
                            mCastManager.getRemoteMediaInformation().getContentId())) {
                mIsFresh = false;
            }
        }
        if (!mCastManager.isConnecting()) {
            boolean shouldFinish = !mCastManager.isConnected()
                    || (mCastManager.getPlaybackStatus() == MediaStatus.PLAYER_STATE_IDLE
                    && mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_FINISHED);
            if (shouldFinish && !mIsFresh) {
                mCastController.closeActivity();
                return;
            }
        }
        mMediaStatus = mCastManager.getMediaStatus();
        mCastManager.addVideoCastConsumer(mCastConsumer);
        mCastManager.addArchosCastManagerListener(this);
        if (!mIsFresh) {
            updatePlayerStatus();
            // updating metadata in case another client has changed it and we are resuming the
            // activity
            mSelectedMedia = mCastManager.getRemoteMediaInformation();
            updateClosedCaptionState();
            updateMetadata();
        }
    } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
        LOGE(TAG, "Failed to get media information or status of media playback", e);
    } finally {
        mCastManager.incrementUiCounter();
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:37,代码来源:VideoCastControllerFragment.java

示例8: onResume

@Override
public void onResume() {
    super.onResume();
    try {
        if (mCastManager.isRemoteMediaPaused() || mCastManager.isRemoteMediaPlaying()) {
            if (mCastManager.getRemoteMediaInformation() != null
                    && TextUtils.equals(mSelectedMedia.getContentId(),
                    mCastManager.getRemoteMediaInformation().getContentId())) {
                mIsFresh = false;
            }
        }
        if (!mCastManager.isConnecting()) {
            boolean shouldFinish = !mCastManager.isConnected()
                    || (mCastManager.getPlaybackStatus() == MediaStatus.PLAYER_STATE_IDLE
                    && mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_FINISHED);
            if (shouldFinish && !mIsFresh) {
                mCastController.closeActivity();
                return;
            }
        }
        mMediaStatus = mCastManager.getMediaStatus();
        mCastManager.addVideoCastConsumer(mCastConsumer);
        if (!mIsFresh) {
            updatePlayerStatus();
            // updating metadata in case another client has changed it and we are resuming the
            // activity
            mSelectedMedia = mCastManager.getRemoteMediaInformation();
            updateClosedCaptionState();
            updateMetadata();
        }
    } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
        LOGE(TAG, "Failed to get media information or status of media playback", e);
    } finally {
        mCastManager.incrementUiCounter();
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:36,代码来源:VideoCastControllerFragment.java

示例9: updatePlaybackState

private void updatePlaybackState() {
    int status = mCastManager.getPlaybackStatus();
    int idleReason = mCastManager.getIdleReason();

    LogHelper.d(TAG, "onRemoteMediaPlayerStatusUpdated ", status);

    // Convert the remote playback states to media playback states.
    switch (status) {
        case MediaStatus.PLAYER_STATE_IDLE:
            if (idleReason == MediaStatus.IDLE_REASON_FINISHED) {
                if (mCallback != null) {
                    mCallback.onCompletion();
                }
            }
            break;
        case MediaStatus.PLAYER_STATE_BUFFERING:
            mState = PlaybackState.STATE_BUFFERING;
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mState);
            }
            break;
        case MediaStatus.PLAYER_STATE_PLAYING:
            mState = PlaybackState.STATE_PLAYING;
            updateMetadata();
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mState);
            }
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            mState = PlaybackState.STATE_PAUSED;
            updateMetadata();
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mState);
            }
            break;
        default: // case unknown
            LogHelper.d(TAG, "State default : ", status);
            break;
    }
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:40,代码来源:CastPlayback.java

示例10: updatePlaybackState

private void updatePlaybackState() {
    int status = mCastManager.getPlaybackStatus();
    int idleReason = mCastManager.getIdleReason();

    LogHelper.d(TAG, "onRemoteMediaPlayerStatusUpdated ", status);

    // Convert the remote playback states to media playback states.
    switch (status) {
        case MediaStatus.PLAYER_STATE_IDLE:
            if (idleReason == MediaStatus.IDLE_REASON_FINISHED) {
                if (mCallback != null) {
                    mCallback.onCompletion();
                }
            }
            break;
        case MediaStatus.PLAYER_STATE_BUFFERING:
            mState = PlaybackStateCompat.STATE_BUFFERING;
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mState);
            }
            break;
        case MediaStatus.PLAYER_STATE_PLAYING:
            mState = PlaybackStateCompat.STATE_PLAYING;
            updateMetadata();
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mState);
            }
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            mState = PlaybackStateCompat.STATE_PAUSED;
            updateMetadata();
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mState);
            }
            break;
        default: // case unknown
            LogHelper.d(TAG, "State default : ", status);
            break;
    }
}
 
开发者ID:SoumyaParida,项目名称:MyGaana-Universal,代码行数:40,代码来源:CastPlayback.java

示例11: updatePlaybackState

private void updatePlaybackState() {
    int status = mRemoteMediaClient.getPlayerState();
    int idleReason = mRemoteMediaClient.getIdleReason();

    LogHelper.d(TAG, "onRemoteMediaPlayerStatusUpdated ", status);

    // Convert the remote playback states to media playback states.
    switch (status) {
        case MediaStatus.PLAYER_STATE_IDLE:
            if (idleReason == MediaStatus.IDLE_REASON_FINISHED) {
                if (mCallback != null) {
                    mCallback.onCompletion();
                }
            }
            break;
        case MediaStatus.PLAYER_STATE_BUFFERING:
            mPlaybackState = PlaybackStateCompat.STATE_BUFFERING;
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mPlaybackState);
            }
            break;
        case MediaStatus.PLAYER_STATE_PLAYING:
            mPlaybackState = PlaybackStateCompat.STATE_PLAYING;
            setMetadataFromRemote();
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mPlaybackState);
            }
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            mPlaybackState = PlaybackStateCompat.STATE_PAUSED;
            setMetadataFromRemote();
            if (mCallback != null) {
                mCallback.onPlaybackStatusChanged(mPlaybackState);
            }
            break;
        default: // case unknown
            LogHelper.d(TAG, "State default : ", status);
            break;
    }
}
 
开发者ID:googlesamples,项目名称:android-UniversalMusicPlayer,代码行数:40,代码来源:CastPlayback.java

示例12: onStatusUpdated

@Override
public void onStatusUpdated() {
    MediaStatus mediaStatus = remoteMediaPlayer.getMediaStatus();
    boolean isPlaying = mediaStatus.getPlayerState() == MediaStatus.PLAYER_STATE_PLAYING;

    // TODO: Do we want to shutdown when there are errors?
    if (mediaStatus.getPlayerState() == MediaStatus.PLAYER_STATE_IDLE &&
        mediaStatus.getIdleReason() == MediaStatus.IDLE_REASON_FINISHED) {

        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Casting:Stop", null));
    }
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:12,代码来源:ChromeCast.java

示例13: togglePlayback

/**
 * Toggles the playback of the movie.
 */
public void togglePlayback() throws CastException, TransientNetworkDisconnectionException, NoConnectionException {
  checkConnectivity();
  boolean isPlaying = isRemoteMoviePlaying();
  if (isPlaying) {
    pause();
  } else {
    if (mState == MediaStatus.PLAYER_STATE_IDLE && mIdleReason == MediaStatus.IDLE_REASON_FINISHED) {
      loadMedia(getRemoteMediaInformation(), true, 0);
    } else {
      play();
    }
  }
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:16,代码来源:VideoCastManager.java

示例14: 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

示例15: 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


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