A solution for browser playback of hls video streams

HLS (HTTP Live Streaming), Apple's dynamic code rate adaptation technology. Mainly used in PC and Apple terminal audio and video services. Includes an m3u(8) index file, TS media fragmentation file, and key encrypted string file.

Hls streams on non-Apple PCs with only Microsoft's Edge support, but support on all three mobile platforms is good, so many PC browsers, such as chrome, need to be coded with flash before playing back to the user. In nplive, a powerful jwplayer (a cracked version was found from iptv, thanks again to Network Center) was selected, called through js.

Here, because flash has cross-domain restrictions on accessing objects, flash will not be able to access the target resource if crosssdomain.xml access to the target root does not allow that access source or if there is no crosssdomain.xml, so crosdomain.xml needs to be deployed at the root of each push server and allow access to the source of the .bitnp.net.

    <allow-access-from domain="*.bitnp.net"/>

Flash's support on mobile devices is poor, so it's important to make a judgment about the type of device the visitor has. The first thing that comes to mind is user-Agent. But because browser and device identities are too numerous and are likely to be omissions in judgment, nplive uses a more sophisticated lightweight Mobile-Detect (https://github.com/serbanghita/Mobile-Detect) and a simple index.php file to judge visitors, and Mobile-Detect has a more comprehensive and accurate UA recognition feature.

Distinguished mobile users will be jumped to the mobile version of the page, video playback is based on video.js and html5 in the video label, most browsers currently support video label, while mobile devices can support hls video streaming, thus solving the hls full platform playback problem.

共有 0 条评论

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.