Java Code Examples for com.google.android.gms.cast.MediaInfo#STREAM_TYPE_BUFFERED
The following examples show how to use
com.google.android.gms.cast.MediaInfo#STREAM_TYPE_BUFFERED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VideoMediaRouteControllerDialog.java From android with Apache License 2.0 | 5 votes |
private Drawable getPauseStopButton() { switch (mStreamType) { case MediaInfo.STREAM_TYPE_BUFFERED: return mPauseDrawable; case MediaInfo.STREAM_TYPE_LIVE: return mStopDrawable; default: return mPauseDrawable; } }
Example 2
Source File: MiniController.java From android with Apache License 2.0 | 5 votes |
private Drawable getPauseStopButton() { switch (mStreamType) { case MediaInfo.STREAM_TYPE_BUFFERED: return mPauseDrawable; case MediaInfo.STREAM_TYPE_LIVE: return mStopDrawable; default: return mPauseDrawable; } }
Example 3
Source File: VideoMediaRouteControllerDialog.java From UTubeTV with The Unlicense | 5 votes |
private Drawable getPauseStopButton() { switch (mStreamType) { case MediaInfo.STREAM_TYPE_BUFFERED: return mPauseDrawable; case MediaInfo.STREAM_TYPE_LIVE: return mStopDrawable; default: return mPauseDrawable; } }
Example 4
Source File: MiniController.java From UTubeTV with The Unlicense | 5 votes |
private Drawable getPauseStopButton() { switch (mStreamType) { case MediaInfo.STREAM_TYPE_BUFFERED: return mPauseDrawable; case MediaInfo.STREAM_TYPE_LIVE: return mStopDrawable; default: return mPauseDrawable; } }
Example 5
Source File: MediaInfoBuilder.java From react-native-google-cast with MIT License | 4 votes |
public static @NonNull MediaInfo buildMediaInfo(@NonNull ReadableMap parameters) { MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE); String title = ReadableMapUtils.getString(parameters, "title"); if (title != null) { movieMetadata.putString(MediaMetadata.KEY_TITLE, title); } String subtitle = ReadableMapUtils.getString(parameters, "subtitle"); if (subtitle != null) { movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, subtitle); } String studio = ReadableMapUtils.getString(parameters, "studio"); if (studio != null) { movieMetadata.putString(MediaMetadata.KEY_STUDIO, studio); } String imageUrl = ReadableMapUtils.getString(parameters, "imageUrl"); if (imageUrl != null) { movieMetadata.addImage(new WebImage(Uri.parse(imageUrl))); } String posterUrl = ReadableMapUtils.getString(parameters, "posterUrl"); if (posterUrl != null) { movieMetadata.addImage(new WebImage(Uri.parse(posterUrl))); } String mediaUrl = ReadableMapUtils.getString(parameters, "mediaUrl"); if (mediaUrl == null) { throw new IllegalArgumentException("mediaUrl option is required"); } Boolean isLive = ReadableMapUtils.getBoolean(parameters, "isLive"); int streamType = isLive != null && isLive ? MediaInfo.STREAM_TYPE_LIVE : MediaInfo.STREAM_TYPE_BUFFERED; MediaInfo.Builder builder = new MediaInfo.Builder(mediaUrl) .setStreamType(streamType) .setMetadata(movieMetadata); String contentType = ReadableMapUtils.getString(parameters, "contentType"); builder = builder.setContentType(contentType != null ? contentType : DEFAULT_CONTENT_TYPE); Map<?, ?> customData = ReadableMapUtils.getMap(parameters, "customData"); if (customData != null) { builder = builder.setCustomData(new JSONObject(customData)); } Integer streamDuration = ReadableMapUtils.getInt(parameters, "streamDuration"); if (streamDuration != null) { builder = builder.setStreamDuration(streamDuration); } ReadableMap textTrackStyle = ReadableMapUtils.getReadableMap(parameters, "textTrackStyle"); if (textTrackStyle != null) { builder = builder.setTextTrackStyle(buildTextTrackStyle(textTrackStyle)); } return builder.build(); }
Example 6
Source File: VideoMediaRouteControllerDialog.java From android with Apache License 2.0 | 4 votes |
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); } } }
Example 7
Source File: MiniController.java From android with Apache License 2.0 | 4 votes |
@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; } }
Example 8
Source File: VideoMediaRouteControllerDialog.java From UTubeTV with The Unlicense | 4 votes |
private void updatePlayPauseState(int state) { if (null != mPausePlay) { switch (state) { case MediaStatus.PLAYER_STATE_PLAYING: mPausePlay.setVisibility(View.VISIBLE); mPausePlay.setImageDrawable(getPauseStopButton()); setLoadingVisibility(false); break; case MediaStatus.PLAYER_STATE_PAUSED: mPausePlay.setVisibility(View.VISIBLE); mPausePlay.setImageDrawable(mPlayDrawable); setLoadingVisibility(false); 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.setVisibility(View.VISIBLE); mPausePlay.setImageDrawable(mPlayDrawable); setLoadingVisibility(false); } else { mPausePlay.setVisibility(View.INVISIBLE); setLoadingVisibility(false); } break; } } break; case MediaStatus.PLAYER_STATE_BUFFERING: mPausePlay.setVisibility(View.INVISIBLE); setLoadingVisibility(true); break; default: mPausePlay.setVisibility(View.INVISIBLE); setLoadingVisibility(false); } } }
Example 9
Source File: MiniController.java From UTubeTV with The Unlicense | 4 votes |
@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; } }