Swift-无法使用AVPlayer播放实时流视频

时间:2019-01-21 13:55:40

标签: ios swift avplayer http-live-streaming

我试图弄清楚为什么我得到这种观点: enter image description here

鉴于确实加载了我正在加载的东西

                    let url = URL(string: url)
                    let asset = AVURLAsset(url: url!)
                    let item = AVPlayerItem(asset: asset)
                    self.player = AVPlayer(playerItem: item)
                    self.avpController.player =  self.player
                    self.present(self.avpController, animated: true) {
                        self.avpController.player?.play()
                  }

唯一有意义的是url不好,但是它可以在浏览器(而不是野生动物园)和vlc播放器中工作:

任何想法都会有所帮助

https://www.name.name/http-name/eyJraWQiOiJmbGlyIiwiYWxnIjoiUlMyNTYifQ.eyJzZXJpYWxTdHJlYW0iOnsiZGV2aWNlSWQiOiJsYW1iZGE6ZGV2aWNlOnVzLWVhc3QtMTo5MzQwMzcwZS0yZGU5LTQwYTMtYjY4Zi02ODk2N2VlYWJlZjk6RGV2aWNlOmVuZzAzMSIsInN0cmVhbSI6InZpc3VhbDEifSwiY2xpZW50Q29udGV4dCI6eyJjbGllbnQiOiI5ZWNiNTI2Ny0wNjk4LTQ4OGUtODZkNy03YmRkMzk5NDFmMjMiLCJzZXNzaW9uSWQiOiJhZjgxOWU0OS03MDcyLTQ5NmUtOTY1Mi1hZWU0NDI1YjlhOWUiLCJyb2xlcyI6WyJVc2VyIl19LCJhY2NvdW50Q29udGV4dCI6eyJhY2NvdW50SWQiOiI5MzQwMzcwZS0yZGU5LTQwYTMtYjY4Zi02ODk2N2VlYWJlZjkiLCJhY2NvdW50VHlwZSI6InRoZXJtYWxzZWN1cml0eSIsInVzZXIiOiI5ZWNiNTI2Ny0wNjk4LTQ4OGUtODZkNy03YmRkMzk5NDFmMjMiLCJzZXNzaW9uSWQiOiJhZjgxOWU0OS03MDcyLTQ5NmUtOTY1Mi1hZWU0NDI1YjlhOWUiLCJyb2xlcyI6W119LCJmbG93SWQiOiI3OGZjZTcxZS05YTRiLTQxMDItOWZjMy0wY2ZmYzk0ZGYwYTkiLCJwcm94eVBhdGgiOiJodHRwOi8vaXAtMTcyLTMwLTItNzcuZWMyLmludGVybmFsOjgwL2FwaS9zdHJlYW1pbmcvbGl2ZS9tcDQvIiwiaXNzIjoiTGFtYmRhU2VydmljZXMiLCJhdWQiOiJMYW1iZGFTZXJ2aWNlcyIsImp0aSI6ImpMUUUxNC1QQ0hEN1ZjcFRWU1FIREEiLCJpYXQiOjE1NDgwNzgxOTksImV4cCI6MTU0ODA4MTc5OX0.CWhDIwZkZDkM322y_0-9FoFdrksNcBKgPUayqX5G8K7yWkoGDvACgMnVI4RLtcLBmHaFDq3ojHB-5BVVCZ3Wgq5CIBWboE3cH5aLNR08qse8wp8UcLdlqgFBDzSCa2XxGl3jWomtalhGaG2rEhT4sxLMTJhCL7Ok0emtlNlJ_b5uU7AAEuYyu7jGgOqU0e2a-uOgOGIBGSSv8RiJdBB33R-SQxWKwOwDqOxBVv0FRld6pdi6E8MBLG45gPhTif7_24bfK57JWf8WiirK4dIHKfEJBY5Kp9zcvvQRRlGmoHrTbC6djlnPQc

1 个答案:

答案 0 :(得分:0)

所以,一天之后,我设法做到了。 我使用了这个出色的指南来与vlc播放器一起玩:https://hackernoon.com/swift-4-ios-app-player-live-stream-video-from-nginx-nginx-rtmp-use-vlckit-f2162134ae5c