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


Java CastSession.getRemoteMediaClient方法代码示例

本文整理汇总了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);
}
 
开发者ID:stephenmcgruer,项目名称:simple-upnp,代码行数:19,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:22,代码来源:QueueListAdapter.java

示例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();
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:10,代码来源:QueueDataProvider.java

示例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;
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:10,代码来源:QueueListViewFragment.java

示例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();
}
 
开发者ID:googlesamples,项目名称:android-UniversalMusicPlayer,代码行数:10,代码来源:CastPlayback.java

示例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;
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:6,代码来源:QueueListViewActivity.java


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