Can you stream from a HTTPS server using HLS?

可紊 提交于 2019-12-08 06:47:49

问题


I'm wondering wether or not it's possible to stream from a HTTPS server using HLS, using the following code -

let url = NSURL(string:"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8")
        let player = AVPlayer(URL: url!)
        let playerController = AVPlayerViewController()

        playerController.player = player
        self.addChildViewController(playerController)
        self.view.addSubview(playerController.view)
        playerController.view.frame = self.view.frame

        player.play()

I can stream from an HTTP server, but when I changed the URL to the URL of my company's server it doesn't work, the only difference is that the video of my company has HTTPS in it's URL and apple's sample video doesn't, I'm testing on the Emulator in XCode


回答1:


Yes, you can stream HLS from an HTTPS server. HLS streams are transfered over HTTP and HTTPS is just HTTP over TLS and most of the time it is transparent to the client. The only thing you need is support for HTTPS in the player which all major ones already have.

https://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8 is not working because the devimages.apple.com certificate is invalid. Just browse the url using your browser. It will warn you and give you additional information about what exactly is wrong.

I guess the problem with your company server is the same - wrong or self-signed certificate.

Another quick way to validate an https server is to user curl. For example:

curl "https://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"

complains with:

curl: (51) SSL: no alternative certificate subject name matches target host name 'devimages.apple.com'


来源:https://stackoverflow.com/questions/35225914/can-you-stream-from-a-https-server-using-hls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!