【发布时间】:2016-11-14 09:50:12
【问题描述】:
我正在开发一个具有使用 chromecast 设备进行视频投射功能的 android 项目。该应用程序在 http 地址视频上运行良好,但不适用于 rtsp。 我正在使用这两个网址
private String videoURL = "https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/DesigningForGoogleCast.mp4"; // working fine
private String videoURL = "rtsp://mpv.cdn3.bigCDN.com:554/bigCDN/definst/mp4:bigbuckbunnyiphone_400.mp4"; // not showing video in cast device but running in android VideoView
这是我在投射设备中开始会话时的代码
@Override
public void onSessionStarted(CastSession session, String sessionId) {
mCastSession = session;
Log.d("session status","started....");
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
movieMetadata.putString(MediaMetadata.KEY_TITLE, videoTitle);
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, videoHead);
movieMetadata.addImage(new WebImage(Uri.parse(smallImageUrl)));
movieMetadata.addImage(new WebImage(Uri.parse(largemageUrl)));
MediaInfo mediaInfo = new MediaInfo.Builder(videoURL)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType("videos/mp4")
.setMetadata(movieMetadata)
.setStreamDuration(10 * 1000)
.build();
Log.d("cast session", ""+mCastSession);
RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
remoteMediaClient.load(mediaInfo, true, 0);
invalidateOptionsMenu();
}
我得到了一些答案,比如 chromecast 不支持 rtsp 地址。我不确定为什么?如果是真的,什么是 rtsp 视频的替代解决方案。
【问题讨论】:
标签: android video chromecast