流视频Swift Xcode10

时间:2018-11-13 05:30:21

标签: php swift laravel

我正在尝试从服务器流式传输视频。如果我下载并放入应用程序包中,它将在Android和iOS中运行。但无法通过URL流。我尝试了其他URL进行流传输,并且一切正常。下面是我正在使用的代码。

      //its working
      //let str = "https://www.radiantmediaplayer.com/media/bbb-360p.mp4"

      //not able to stream from this url
      let str = "http://158.69.119.121:5555/uploads/post_images/dyqZzJprVCgUxX676ELQTbmEk32EjzBIqrbqhKyr2Sk9fATIa9.mp4"

        if let url = URL(string: str){

            let player = AVPlayer(url: url)
            let playervc = AVPlayerViewController()
            playervc.player = player
            self.present(playervc, animated: true) {
                playervc.player!.play()
            }
        }

0 个答案:

没有答案