本文整理汇总了Java中com.google.android.gms.cast.framework.media.RemoteMediaClient.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteMediaClient.addListener方法的具体用法?Java RemoteMediaClient.addListener怎么用?Java RemoteMediaClient.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.cast.framework.media.RemoteMediaClient
的用法示例。
在下文中一共展示了RemoteMediaClient.addListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: syncWithRemoteQueue
import com.google.android.gms.cast.framework.media.RemoteMediaClient; //导入方法依赖的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: loadRemoteMedia
import com.google.android.gms.cast.framework.media.RemoteMediaClient; //导入方法依赖的package包/类
private void loadRemoteMedia(int position, boolean autoPlay) {
if (mCastSession == null) {
return;
}
final RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
if (remoteMediaClient == null) {
return;
}
remoteMediaClient.addListener(new RemoteMediaClient.Listener() {
@Override
public void onStatusUpdated() {
Intent intent = new Intent(LocalPlayerActivity.this, ExpandedControlsActivity.class);
startActivity(intent);
remoteMediaClient.removeListener(this);
}
@Override
public void onMetadataUpdated() {
}
@Override
public void onQueueStatusUpdated() {
}
@Override
public void onPreloadStatusUpdated() {
}
@Override
public void onSendingRemoteMediaRequest() {
}
});
remoteMediaClient.load(mSelectedMedia, autoPlay, position);
}
示例3: loadRemoteMedia
import com.google.android.gms.cast.framework.media.RemoteMediaClient; //导入方法依赖的package包/类
private void loadRemoteMedia(int position, boolean autoPlay) {
if (mCastSession == null) {
return;
}
final RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
if (remoteMediaClient == null) {
return;
}
remoteMediaClient.addListener(new RemoteMediaClient.Listener() {
@Override
public void onStatusUpdated() {
Intent intent = new Intent(LocalPlayerActivity.this, ExpandedControlsActivity.class);
startActivity(intent);
remoteMediaClient.removeListener(this);
}
@Override
public void onMetadataUpdated() {
}
@Override
public void onQueueStatusUpdated() {
}
@Override
public void onPreloadStatusUpdated() {
}
@Override
public void onSendingRemoteMediaRequest() {
}
@Override
public void onAdBreakStatusUpdated() {
}
});
remoteMediaClient.load(mSelectedMedia, autoPlay, position);
}
示例4: castVideo
import com.google.android.gms.cast.framework.media.RemoteMediaClient; //导入方法依赖的package包/类
private void castVideo(Anime anime, String url){
final RemoteMediaClient mediaClient = castSession.getRemoteMediaClient();
MediaMetadata animeMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
animeMetadata.putString(MediaMetadata.KEY_TITLE, anime.title);
if(anime.coverURL != null && !anime.coverURL.isEmpty()) {
animeMetadata.addImage(new WebImage(Uri.parse(anime.coverURL)));
}
MediaInfo animeInfo = new MediaInfo.Builder(url)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType("video/mp4")
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setMetadata(animeMetadata)
.build();
mediaClient.addListener(new RemoteMediaClient.Listener() {
@Override
public void onStatusUpdated() {
Intent intent = new Intent(AnimeActivity.this, CastActivity.class);
startActivity(intent);
mediaClient.removeListener(this);
finish();
}
@Override
public void onMetadataUpdated() {}
@Override
public void onQueueStatusUpdated() {}
@Override
public void onPreloadStatusUpdated() {}
@Override
public void onSendingRemoteMediaRequest() {}
});
mediaClient.load(animeInfo, true, 0);
}
示例5: loadRemoteMedia
import com.google.android.gms.cast.framework.media.RemoteMediaClient; //导入方法依赖的package包/类
private void loadRemoteMedia(int position, boolean autoPlay) {
if (mCastSession == null) {
return;
}
final RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
if (remoteMediaClient == null) {
return;
}
remoteMediaClient.addListener(new RemoteMediaClient.Listener() {
@Override
public void onStatusUpdated() {
Intent intent = new Intent(LocalPlayerActivity.this, ExpandedControlsActivity.class);
startActivity(intent);
remoteMediaClient.removeListener(this);
}
@Override
public void onMetadataUpdated() {
}
@Override
public void onQueueStatusUpdated() {
}
@Override
public void onPreloadStatusUpdated() {
}
@Override
public void onSendingRemoteMediaRequest() {
}
@Override
public void onAdBreakStatusUpdated() {
}
});
remoteMediaClient.load(buildMediaInfo(), autoPlay, position);
}
示例6: loadRemoteMedia
import com.google.android.gms.cast.framework.media.RemoteMediaClient; //导入方法依赖的package包/类
private void loadRemoteMedia(final long position, boolean autoPlay) {
currentPosition = position;
final RemoteMediaClient remoteMediaClient = castSession.getRemoteMediaClient();
remoteMediaClient.addListener(new RemoteMediaClient.Listener() {
@Override
public void onStatusUpdated() {
if (isResumed()) {
if (isRemoteVideoPlaying()) {
playbackState = PlaybackState.PLAYING;
updateLocalVideoVolume(0.0f);
if (!isLocalVideoPrepared)
// Prepare the player with the source.
exoPlayer.prepare(getMediaSource(videoUrl));
updateLocalVideoPosition(position);
resumeLocalVideo();
castInfoTextView.setText(String.format("Casting to %s", castSession.getCastDevice().getFriendlyName()));
remoteMediaClient.removeListener(this);
} else {
if (playbackState == PlaybackState.PLAYING) {
castInfoTextView.setText(getString(R.string.cast_is_loading));
}
}
castInfoTextView.setVisibility(View.VISIBLE);
// Intent intent = new Intent(LocalPlayerActivity.this, ExpandedControlsActivity.class);
// startActivity(intent);
// remoteMediaClient.removeListener(this);
}
}
@Override
public void onMetadataUpdated() {
}
@Override
public void onQueueStatusUpdated() {
}
@Override
public void onPreloadStatusUpdated() {
}
@Override
public void onSendingRemoteMediaRequest() {
}
@Override
public void onAdBreakStatusUpdated() {
}
});
castSession.getRemoteMediaClient().load(buildMediaInfo(), autoPlay, position);
}
示例7: loadRemoteMedia
import com.google.android.gms.cast.framework.media.RemoteMediaClient; //导入方法依赖的package包/类
private void loadRemoteMedia(final long position, boolean autoPlay) {
currentPosition = position;
final RemoteMediaClient remoteMediaClient = castSession.getRemoteMediaClient();
remoteMediaClient.addListener(new RemoteMediaClient.Listener() {
@Override
public void onStatusUpdated() {
//if (isResumed()) {
if (isRemoteVideoPlaying()) {
playbackState = PlaybackState.PLAYING;
updateLocalVideoVolume(0.0f);
if (!isLocalVideoPrepared)
// Prepare the player with the source.
exoPlayer.prepare(getMediaSource(videoUrl));
updateLocalVideoPosition(position);
resumeLocalVideo();
castInfoTextView.setText(String.format("Casting to %s", castSession.getCastDevice().getFriendlyName()));
remoteMediaClient.removeListener(this);
} else {
if (playbackState == PlaybackState.PLAYING) {
castInfoTextView.setText(getString(R.string.cast_is_loading));
}
}
castInfoTextView.setVisibility(View.VISIBLE);
// Intent intent = new Intent(LocalPlayerActivity.this, ExpandedControlsActivity.class);
// startActivity(intent);
// remoteMediaClient.removeListener(this);
//}
}
@Override
public void onMetadataUpdated() {
}
@Override
public void onQueueStatusUpdated() {
}
@Override
public void onPreloadStatusUpdated() {
}
@Override
public void onSendingRemoteMediaRequest() {
}
@Override
public void onAdBreakStatusUpdated() {
}
});
castSession.getRemoteMediaClient().load(buildMediaInfo(), autoPlay, position);
}
示例8: loadRemoteMedia
import com.google.android.gms.cast.framework.media.RemoteMediaClient; //导入方法依赖的package包/类
private void loadRemoteMedia(final long position, boolean autoPlay) {
currentPosition = position;
final RemoteMediaClient remoteMediaClient = castSession.getRemoteMediaClient();
remoteMediaClient.addListener(new RemoteMediaClient.Listener() {
@Override
public void onStatusUpdated() {
if(isResumed()){
if(isRemoteVideoPlaying()) {
playbackState = PlaybackState.PLAYING;
updateLocalVideoVolume(0.0f);
if(!isLocalVideoPrepared)
// Prepare the player with the source.
exoPlayer.prepare(getMediaSource(videoUrl));
updateLocalVideoPosition(position);
resumeLocalVideo();
castInfoTextView.setText(String.format("Casting to %s", castSession.getCastDevice().getFriendlyName()));
remoteMediaClient.removeListener(this);
} else {
if(playbackState == PlaybackState.PLAYING){
castInfoTextView.setText(getString(R.string.cast_is_loading));
}
}
castInfoTextView.setVisibility(View.VISIBLE);
// Intent intent = new Intent(LocalPlayerActivity.this, ExpandedControlsActivity.class);
// startActivity(intent);
// remoteMediaClient.removeListener(this);
}
}
@Override
public void onMetadataUpdated() {
}
@Override
public void onQueueStatusUpdated() {
}
@Override
public void onPreloadStatusUpdated() {
}
@Override
public void onSendingRemoteMediaRequest() {
}
@Override
public void onAdBreakStatusUpdated() {
}
});
castSession.getRemoteMediaClient().load(buildMediaInfo(), autoPlay, position);
}