CHROMECAST视频使用iOS应用程序的本地URL(错误)

问题描述 投票:0回答:1

我想的Chromecast发挥出自己的本地URL的视频。我不熟悉如何实现,下面是试图代码,我could'nt发现很多图书馆做Chrome使用本地URL,并通过控制手机远程(播放/停止)播放视频。如果有任何人知道可以用好的库指南或建议代码它。请..

override func viewDidLoad() {
    super.viewDidLoad()
    let castButton = GCKUICastButton(frame: CGRect(x: 0, y: 0, width: 24, height: 24))
    castButton.tintColor = UIColor.red
    let castBarButtonItem = UIBarButtonItem(customView: castButton)
    navigationItem.rightBarButtonItem = castBarButtonItem
    Casty.shared.initialize()
    let url: String  = "https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/DesigningForGoogleCast.mp4"
    let subtitleURL = "https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/tracks/DesigningForGoogleCast-en.vtt"
    let subtitle = GCKMediaTrack(identifier: 1, contentIdentifier: subtitleURL , contentType: "text/vtt", type: GCKMediaTrackType.text, textSubtype: GCKMediaTextTrackSubtype.captions, name: "English", languageCode: "en", customData: nil)

    //this image will show up in expanded controller as well as video thumb
    let image = GCKImage(url: URL(string: "https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/images/780x1200/DesigningForGoogleCast-887x1200.jpg")!, width: 780, height: 1200)

    Casty.didStartSession = { _ in
        Casty.shared.loadMedia(url: self.url , subtitles: [subtitle] , activeSubtitleID: 1 , title: "Dev" , image: image)
        Casty.shared.presentExpandedController()
        Casty.shared.addMiniController(toParentViewController: self)
    }}
ios arrays swift chromecast google-cast
1个回答
0
投票

该铸造媒体播放器只支持播放通过HTTP。因此,你需要有本地Web服务器,让玩家访问您的本地内容。

© www.soinside.com 2019 - 2024. All rights reserved.