本文整理汇总了Java中com.google.android.gms.cast.MediaStatus.getQueueItems方法的典型用法代码示例。如果您正苦于以下问题:Java MediaStatus.getQueueItems方法的具体用法?Java MediaStatus.getQueueItems怎么用?Java MediaStatus.getQueueItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.cast.MediaStatus
的用法示例。
在下文中一共展示了MediaStatus.getQueueItems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: syncWithRemoteQueue
import com.google.android.gms.cast.MediaStatus; //导入方法依赖的package包/类
private void syncWithRemoteQueue() {
RemoteMediaClient remoteMediaClient = getRemoteMediaClient();
if (remoteMediaClient != null) {
remoteMediaClient.addListener(mRemoteMediaClientListener);
MediaStatus mediaStatus = remoteMediaClient.getMediaStatus();
if (mediaStatus != null) {
List<MediaQueueItem> items = mediaStatus.getQueueItems();
if (items != null && !items.isEmpty()) {
mQueue.clear();
mQueue.addAll(items);
mRepeatMode = mediaStatus.getQueueRepeatMode();
mCurrentIem = mediaStatus.getQueueItemById(mediaStatus.getCurrentItemId());
mDetachedQueue = false;
mUpcomingItem = mediaStatus.getQueueItemById(mediaStatus.getPreloadedItemId());
}
}
}
}
示例2: updateMediaQueue
import com.google.android.gms.cast.MediaStatus; //导入方法依赖的package包/类
private void updateMediaQueue() {
RemoteMediaClient remoteMediaClient = getRemoteMediaClient();
MediaStatus mediaStatus;
List<MediaQueueItem> queueItems = null;
if (remoteMediaClient != null) {
mediaStatus = remoteMediaClient.getMediaStatus();
if (mediaStatus != null) {
queueItems = mediaStatus.getQueueItems();
mRepeatMode = mediaStatus.getQueueRepeatMode();
mCurrentIem = mediaStatus.getQueueItemById(mediaStatus.getCurrentItemId());
}
}
mQueue.clear();
if (queueItems == null) {
Log.d(TAG, "Queue is cleared");
} else {
Log.d(TAG, "Queue is updated with a list of size: " + queueItems.size());
if (queueItems.size() > 0) {
mQueue.addAll(queueItems);
mDetachedQueue = false;
} else {
mDetachedQueue = true;
}
}
}
示例3: onResume
import com.google.android.gms.cast.MediaStatus; //导入方法依赖的package包/类
@Override
protected void onResume() {
mCastContext.getSessionManager().addSessionManagerListener(
mSessionManagerListener, CastSession.class);
if (mRemoteMediaClient == null) {
mRemoteMediaClient = getRemoteMediaClient();
}
if (mRemoteMediaClient != null) {
mRemoteMediaClient.addListener(mRemoteMediaClientListener);
MediaStatus mediaStatus = mRemoteMediaClient.getMediaStatus();
List<MediaQueueItem> queueItems =
(mediaStatus == null) ? null : mediaStatus.getQueueItems();
if (queueItems != null && !queueItems.isEmpty()) {
mEmptyView.setVisibility(View.GONE);
}
}
super.onResume();
}
示例4: prepareForNextTrack
import com.google.android.gms.cast.MediaStatus; //导入方法依赖的package包/类
public void prepareForNextTrack() {
if (isConnected() && hasCurrent()) {
MediaStatus status = mRemoteMediaPlayer.getMediaStatus();
if (status.getQueueItemCount() > 1) {
int current = status.getCurrentItemId();
int[] ids = new int[status.getQueueItemCount()-1];
int ii=0;
for (MediaQueueItem item : status.getQueueItems()) {
if (item.getItemId() != current) {
ids[ii++] = item.getItemId();
}
}
try {
mRemoteMediaPlayer.queueRemoveItems(mApiClient, ids, null).await();
} catch (IllegalArgumentException e) {
Timber.e(e, "prepareForNextTrack");
}
}
}
}
示例5: updateMediaQueue
import com.google.android.gms.cast.MediaStatus; //导入方法依赖的package包/类
private void updateMediaQueue() {
MediaStatus mediaStatus = mRemoteMediaClient.getMediaStatus();
List<MediaQueueItem> queueItems =
(mediaStatus == null) ? null : mediaStatus.getQueueItems();
if (queueItems == null || queueItems.isEmpty()) {
mEmptyView.setVisibility(View.VISIBLE);
} else {
mEmptyView.setVisibility(View.GONE);
}
}