如何将已编码的hls v4 / v5流式传输到Chromecast?

时间:2019-01-02 11:12:33

标签: swift chromecast google-cast

我在将视频网址投射到Chromecast时遇到了问题

我无法播放此视频

http://cdnlb.tvplayhome.lt/vod/eds/220830_test1/220830_test1/_/hls_v4/220830_test1.m3u8

但是如果我切换到hls_v3或2或1,它将在播放

http://cdnlb.tvplayhome.lt/vod/eds/220830_test1/220830_test1/_/hls_v3/220830_test1.m3u8

这是基本的实现方式

            let url = URL.init(string: "http://cdnlb.tvplayhome.lt/vod/eds/220830_test1/220830_test1/_/hls_v4/220830_test1.m3u8")
        guard let mediaURL = url else {
            print("invalid mediaURL")
            return
        }

        let mediaInfoBuilder = GCKMediaInformationBuilder.init(contentURL: mediaURL)
        mediaInfoBuilder.streamType = GCKMediaStreamType.none;
        mediaInfoBuilder.contentType = "application/x-mpegURL"
        mediaInfoBuilder.metadata = metadata
        mediaInfoBuilder.mediaTracks = nil
        let mediaInformation = mediaInfoBuilder.build()

        let rmc = GCKCastContext.sharedInstance().sessionManager.currentCastSession?.remoteMediaClient


        let request = rmc?.loadMedia(mediaInformation)
        request!.delegate = self

我正在控制台中找到它

cast connected
-[GCKMediaControlChannel didReceiveTextMessage:] - Received unexpected error: Invalid Request.
-[GCKMediaQueue request:didFailWithError:] - error fetching queue item IDs: Error Domain=com.google.cast.GCKError Code=4 "Invalid request" UserInfo={NSLocalizedDescription=Invalid request}

0 个答案:

没有答案