本文整理汇总了Java中com.google.android.gms.cast.MediaStatus.PLAYER_STATE_IDLE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaStatus.PLAYER_STATE_IDLE属性的具体用法?Java MediaStatus.PLAYER_STATE_IDLE怎么用?Java MediaStatus.PLAYER_STATE_IDLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.android.gms.cast.MediaStatus
的用法示例。
在下文中一共展示了MediaStatus.PLAYER_STATE_IDLE属性的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;
}
示例2: CastDebug
public CastDebug(Context context){
super();
sCastDebug = this;
mContext = context;
mHandler = new android.os.Handler(){
public void handleMessage(Message msg) {
try {
if((ArchosVideoCastManager.getInstance().isRemoteMediaPlaying()||
ArchosVideoCastManager.getInstance().getPlaybackStatus()== MediaStatus.PLAYER_STATE_IDLE)&&is_media_loading){
goToNextVideo();
}
} catch (TransientNetworkDisconnectionException e) {
e.printStackTrace();
} catch (NoConnectionException e) {
e.printStackTrace();
}
}
};
mVideoMapper = new VideoCursorMapper();
ArchosVideoCastManager.getInstance().addArchosCastManagerListener(this);
}
示例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;
}
示例4: 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();
}
}
}
示例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;
}
}
示例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;
}
示例7: 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();
}
}
}
示例8: 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;
}
}
示例9: 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;
}
示例10: 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();
}
示例11: 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);
}
示例12: 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();
}
示例13: 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();
}
}
示例14: 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);
}
示例15: 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();
}
}
}