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


Java MediaStatus.PLAYER_STATE_PAUSED属性代码示例

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


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

示例1: getPlaybackStatus

public int getPlaybackStatus() {
    if(mIsPreparing) {
        return ArchosMediaStatus.PLAYER_STATE_PREPARING;
    }
    if(mIsSwitching) {
        return ArchosMediaStatus.PLAYER_STATE_SWITCHING;
    }
    if(Player.sPlayer !=null){
        if(Player.sPlayer.isBusy()){
            return MediaStatus.PLAYER_STATE_PLAYING;
        }
        if (Player.sPlayer.isPlaying()){
            return MediaStatus.PLAYER_STATE_PLAYING;
        }
        if(!Player.sPlayer.isPlaying()&&Player.sPlayer.isInPlaybackState()){
            return MediaStatus.PLAYER_STATE_PAUSED;
        }
    }else if (mCastManager.isConnected()){
        return mCastManager.getPlaybackStatus();
    }
    return MediaStatus.PLAYER_STATE_IDLE;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:22,代码来源:ArchosVideoCastManager.java

示例2: onStopTrackingTouch

@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    try {
        if (mPlaybackState == MediaStatus.PLAYER_STATE_PLAYING) {
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            mCastController.setPlaybackStatus(mPlaybackState);
            mCastManager.play(seekBar.getProgress());
        } else if (mPlaybackState == MediaStatus.PLAYER_STATE_PAUSED) {
            mCastManager.seek(seekBar.getProgress());
        }
        restartTrickplayTimer();
    } catch (Exception e) {
        LOGE(TAG, "Failed to complete seek", e);
        mCastController.closeActivity();
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:16,代码来源:VideoCastControllerFragment.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.
 *
 * @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

示例4: updatePlayPauseButtonImageResource

private void updatePlayPauseButtonImageResource(ImageButton button) {
    CastSession castSession = CastContext.getSharedInstance(mAppContext)
            .getSessionManager().getCurrentCastSession();
    RemoteMediaClient remoteMediaClient =
            (castSession == null) ? null : castSession.getRemoteMediaClient();
    if (remoteMediaClient == null) {
        button.setVisibility(View.GONE);
        return;
    }
    int status = remoteMediaClient.getPlayerState();
    switch (status) {
        case MediaStatus.PLAYER_STATE_PLAYING:
            button.setImageResource(PAUSE_RESOURCE);
            break;
        case MediaStatus.PLAYER_STATE_PAUSED:
            button.setImageResource(PLAY_RESOURCE);
            break;
        default:
            button.setVisibility(View.GONE);
    }
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:21,代码来源:QueueListAdapter.java

示例5: getPlayStatus

/**
 * 再生状態を文字列に変換する.
 * 
 * @param   playState   再生状態
 * @return  再生状態の文字列を返す
 */
public String getPlayStatus(final int playState) {
    switch (playState) {
    case MediaStatus.PLAYER_STATE_BUFFERING:
        return MESSAGE_BUFFERING;
    case MediaStatus.PLAYER_STATE_IDLE:
        return MESSAGE_STOP;
    case MediaStatus.PLAYER_STATE_PAUSED:
        return MESSAGE_PAUSED;
    case MediaStatus.PLAYER_STATE_PLAYING:
        return MESSAGE_PALYING;
    case MediaStatus.PLAYER_STATE_UNKNOWN:
    default:
        return MESSAGE_UNKNOWN;
    }
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:21,代码来源:ChromeCastMediaPlayerProfile.java

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

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

示例8: onReady

public void onReady(MediaInfo mediaInfo, boolean shouldStartPlayback, int startPoint) {
  mSelectedMedia = mediaInfo;
  try {
    mCastController.setStreamType(mSelectedMedia.getStreamType());
    if (shouldStartPlayback) {
      // need to start remote playback
      mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
      mCastController.setPlaybackStatus(mPlaybackState);
      mCastManager.loadMedia(mSelectedMedia, true, startPoint);
    } else {
      // we don't change the status of remote playback
      if (mCastManager.isRemoteMoviePlaying()) {
        mPlaybackState = MediaStatus.PLAYER_STATE_PLAYING;
      } else {
        mPlaybackState = MediaStatus.PLAYER_STATE_PAUSED;
      }
      mCastController.setPlaybackStatus(mPlaybackState);
    }
  } catch (Exception e) {
    CastUtils.LOGE(TAG, "Failed to get playback and media information", e);
    mCastController.closeActivity();
  }
  updateMetadata();
  restartTrickplayTimer();
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:25,代码来源:VideoCastControllerFragment.java

示例9: onStopTrackingTouch

@Override
public void onStopTrackingTouch(SeekBar seekBar) {
  try {
    if (mPlaybackState == MediaStatus.PLAYER_STATE_PLAYING) {
      mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
      mCastController.setPlaybackStatus(mPlaybackState);
      mCastManager.play(seekBar.getProgress());
    } else if (mPlaybackState == MediaStatus.PLAYER_STATE_PAUSED) {
      mCastManager.seek(seekBar.getProgress());
    }
    restartTrickplayTimer();
  } catch (Exception e) {
    CastUtils.LOGE(TAG, "Failed to complete seek", e);
    mCastController.closeActivity();
  }
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:16,代码来源:VideoCastControllerFragment.java

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

示例11: onReady

private void onReady(MediaInfo mediaInfo, boolean shouldStartPlayback, int startPoint,
        JSONObject customData) {
    mSelectedMedia = mediaInfo;
    try {
        mCastController.setStreamType(mSelectedMedia.getStreamType());
        if (shouldStartPlayback) {
            // need to start remote playback
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            mCastController.setPlaybackStatus(mPlaybackState);
            mCastManager.loadMedia(mSelectedMedia, true, startPoint, customData);
        } else {
            // we don't change the status of remote playback
            if (mCastManager.isRemoteMoviePlaying()) {
                mPlaybackState = MediaStatus.PLAYER_STATE_PLAYING;
            } else {
                mPlaybackState = MediaStatus.PLAYER_STATE_PAUSED;
            }
            mCastController.setPlaybackStatus(mPlaybackState);
        }
    } catch (Exception e) {
        LOGE(TAG, "Failed to get playback and media information", e);
        mCastController.closeActivity();
    }
    updateMetadata();
    restartTrickplayTimer();
}
 
开发者ID:TByron,项目名称:Jupiter-Broadcasting-Holo,代码行数:26,代码来源:VideoCastControllerFragment.java

示例12: onReady

/**
 * Loads the media on the cast device.
 *
 * @param mediaInfo The media to be loaded
 * @param shouldStartPlayback If {@code true}, playback starts after load automatically
 * @param startPoint The position to start the play back
 * @param customData An optional custom data to be sent along the load api; it can be
 * {@code null}
 */
private void onReady(MediaInfo mediaInfo, boolean shouldStartPlayback, int startPoint,
                     JSONObject customData) {
    mSelectedMedia = mediaInfo;
    updateClosedCaptionState();
    try {
        mCastController.setStreamType(mSelectedMedia.getStreamType());
        if (shouldStartPlayback) {
            // need to start remote playback
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            mCastController.setPlaybackStatus(mPlaybackState);
            mCastManager.loadMedia(mSelectedMedia, true, startPoint, customData);
        } else {
            // we don't change the status of remote playback
            if (mCastManager.isRemoteMediaPlaying()) {
                mPlaybackState = MediaStatus.PLAYER_STATE_PLAYING;
            } else {
                mPlaybackState = MediaStatus.PLAYER_STATE_PAUSED;
            }
            mCastController.setPlaybackStatus(mPlaybackState);
        }
    } catch (Exception e) {
        LOGE(TAG, "Failed to get playback and media information", e);
        mCastController.closeActivity();
    }
    MediaQueue mediaQueue = mCastManager.getMediaQueue();
    int size = 0;
    int position = 0;
    if (mediaQueue != null) {
        size = mediaQueue.getCount();
        position = mediaQueue.getCurrentItemPosition();
    }
    mCastController.onQueueItemsUpdated(size, position);
    updateMetadata();
    restartTrickplayTimer();
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:44,代码来源:VideoCastControllerFragment.java

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

示例14: onPlayPauseClicked

@Override
public void onPlayPauseClicked(View v) throws CastException,
        TransientNetworkDisconnectionException, NoConnectionException {
    checkConnectivity();
    if (mState == MediaStatus.PLAYER_STATE_PLAYING) {
        pause();
    } else {
        boolean isLive = isRemoteStreamLive();
        if ((mState == MediaStatus.PLAYER_STATE_PAUSED && !isLive)
                || (mState == MediaStatus.PLAYER_STATE_IDLE && isLive)) {
            play();
        }
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:14,代码来源:VideoCastManager.java

示例15: onReady

/**
 * Loads the media on the cast device.
 *
 * @param mediaInfo The media to be loaded
 * @param shouldStartPlayback If {@code true}, playback starts after load automatically
 * @param startPoint The position to start the play back
 * @param customData An optional custom data to be sent along the load api; it can be
 * {@code null}
 */
private void onReady(MediaInfo mediaInfo, boolean shouldStartPlayback, int startPoint,
        JSONObject customData) {
    mSelectedMedia = mediaInfo;
    updateClosedCaptionState();
    try {
        mCastController.setStreamType(mSelectedMedia.getStreamType());
        if (shouldStartPlayback) {
            // need to start remote playback
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            mCastController.setPlaybackStatus(mPlaybackState);
            mCastManager.loadMedia(mSelectedMedia, true, startPoint, customData);
        } else {
            // we don't change the status of remote playback
            if (mCastManager.isRemoteMediaPlaying()) {
                mPlaybackState = MediaStatus.PLAYER_STATE_PLAYING;
            } else {
                mPlaybackState = MediaStatus.PLAYER_STATE_PAUSED;
            }
            mCastController.setPlaybackStatus(mPlaybackState);
        }
    } catch (Exception e) {
        LOGE(TAG, "Failed to get playback and media information", e);
        mCastController.closeActivity();
    }
    MediaQueue mediaQueue = mCastManager.getMediaQueue();
    int size = 0;
    int position = 0;
    if (mediaQueue != null) {
        size = mediaQueue.getCount();
        position = mediaQueue.getCurrentItemPosition();
    }
    mCastController.onQueueItemsUpdated(size, position);
    updateMetadata();
    restartTrickplayTimer();
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:44,代码来源:VideoCastControllerFragment.java


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