0
如何将Google Cast v3与ExoPlayer v2完全集成?该活动将包含一个FrameLayout
其中包含com.google.android.exoplayer2.ui.SimpleExoPlayerView
。 Google tutorial仅涵盖与VideoView
的集成。如何将Google Cast v3与ExoPlayer v2集成?
如何将Google Cast v3与ExoPlayer v2完全集成?该活动将包含一个FrameLayout
其中包含com.google.android.exoplayer2.ui.SimpleExoPlayerView
。 Google tutorial仅涵盖与VideoView
的集成。如何将Google Cast v3与ExoPlayer v2集成?
谷歌演员SDK是独立的本地播放器,就可以使用ExoPlayer
或MediaPlayer
(VideoView
)
一旦你的应用程序有一个活动会话,将URL中MediaInfo
val movieMetadata = MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE)
movieMetadata.putString(MediaMetadata.KEY_TITLE, "Title")
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, "Sub")
val mediaLoadOptions = MediaInfo.Builder(<URL>)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType(< Content Type of Media>)
.setMetadata(movieMetadata)
.setStreamDuration(<Media Duration >)
.build()
mCastSession.remoteMediaClient.load(buildMediaInfo(url), mediaLoadOptions)
如果您需要流式传输本地媒体时,您需要自己使用NanoHttpd或另一个您自己的媒体流,并且还需要实现一个Cast Receiver