【问题标题】:Chromecast - Application not working for rtsp video addresses(android)Chromecast - 应用程序不适用于 rtsp 视频地址(android)
【发布时间】: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


    【解决方案1】:

    Chromecast 不支持 RTSP 协议。您需要为您的视频找到另一个受支持的流(例如,许多网络摄像头提供 rtsp 和 http 流)。

    【讨论】:

    • 感谢阿里的回复。我必须制作接收器应用程序,因为我只能选择播放 rtsp 和 hls 地址视频吗?我不清楚。
    • 我不确定您打算如何通过自定义接收器为 rtsp 提供支持;如果平台(chromecast)不支持该协议,我认为这是不可行的。
    猜你喜欢
    • 2014-09-22
    • 1970-01-01
    • 1970-01-01
    • 2014-06-20
    • 1970-01-01
    • 1970-01-01
    • 2017-08-17
    • 2019-04-30
    • 2012-09-15
    相关资源
    最近更新 更多