本文整理汇总了Java中com.google.android.gms.cast.framework.CastSession.getRemoteMediaClient方法的典型用法代码示例。如果您正苦于以下问题:Java CastSession.getRemoteMediaClient方法的具体用法?Java CastSession.getRemoteMediaClient怎么用?Java CastSession.getRemoteMediaClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.cast.framework.CastSession
的用法示例。
在下文中一共展示了CastSession.getRemoteMediaClient方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playFiles
import com.google.android.gms.cast.framework.CastSession; //导入方法依赖的package包/类
@Override
public void playFiles(List<MediaQueueItem> mediaItems) {
CastSession castSession =
CastContext.getSharedInstance(this).getSessionManager().getCurrentCastSession();
if (castSession == null) {
Toast.makeText(this, "Not connected", Toast.LENGTH_LONG).show();
return;
}
// For variety, shuffle the list.
Collections.shuffle(mediaItems);
Log.d(TAG, "playFiles: sending " + mediaItems.size() + " files to Chromecast");
RemoteMediaClient mediaClient = castSession.getRemoteMediaClient();
int startIndex = 0;
mediaClient.queueLoad(mediaItems.toArray(new MediaQueueItem[0]), startIndex,
MediaStatus.REPEAT_MODE_REPEAT_ALL_AND_SHUFFLE, null);
}
示例2: updatePlayPauseButtonImageResource
import com.google.android.gms.cast.framework.CastSession; //导入方法依赖的package包/类
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);
}
}
示例3: getRemoteMediaClient
import com.google.android.gms.cast.framework.CastSession; //导入方法依赖的package包/类
private RemoteMediaClient getRemoteMediaClient() {
CastSession castSession = CastContext.getSharedInstance(mAppContext).getSessionManager()
.getCurrentCastSession();
if (castSession == null || !castSession.isConnected()) {
Log.w(TAG, "Trying to get a RemoteMediaClient when no CastSession is started.");
return null;
}
return castSession.getRemoteMediaClient();
}
示例4: getRemoteMediaClient
import com.google.android.gms.cast.framework.CastSession; //导入方法依赖的package包/类
private RemoteMediaClient getRemoteMediaClient() {
CastSession castSession =
CastContext.getSharedInstance(getContext()).getSessionManager()
.getCurrentCastSession();
if (castSession != null && castSession.isConnected()) {
return castSession.getRemoteMediaClient();
}
return null;
}
示例5: CastPlayback
import com.google.android.gms.cast.framework.CastSession; //导入方法依赖的package包/类
public CastPlayback(MusicProvider musicProvider, Context context) {
mMusicProvider = musicProvider;
mAppContext = context.getApplicationContext();
CastSession castSession = CastContext.getSharedInstance(mAppContext).getSessionManager()
.getCurrentCastSession();
mRemoteMediaClient = castSession.getRemoteMediaClient();
mRemoteMediaClientListener = new CastMediaClientListener();
}
示例6: getRemoteMediaClient
import com.google.android.gms.cast.framework.CastSession; //导入方法依赖的package包/类
private RemoteMediaClient getRemoteMediaClient() {
CastSession castSession = mCastContext.getSessionManager().getCurrentCastSession();
return (castSession != null && castSession.isConnected())
? castSession.getRemoteMediaClient() : null;
}