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


Java RemoteMediaClient.addListener方法代码示例

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

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

示例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);
}
 
开发者ID:googlecast,项目名称:CastVideos-android,代码行数:39,代码来源:LocalPlayerActivity.java

示例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);
}
 
开发者ID:daose,项目名称:KSAnime,代码行数:34,代码来源:AnimeActivity.java

示例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);
}
 
开发者ID:googlecodelabs,项目名称:cast-videos-android,代码行数:40,代码来源:LocalPlayerActivity.java

示例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);
    }
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:59,代码来源:VideoDetailsFragment.java

示例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);
    }
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:59,代码来源:VideoPlayerActivity.java

示例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);
    }
 
开发者ID:lawloretienne,项目名称:Loop,代码行数:59,代码来源:VideoDetailsFragment.java


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