Let Chrome not see the WWDC live HLS technical explanation

Source: Internet
Author: User
Tags microsoft edge
This is a creation in Article, where the information may have evolved or changed.

Requirements:live streaming uses Apple ' s HTTP Live streaming (HLS) technology. HLS requires an iPhone, IPad, or iPod touch with Safari on IOS 7.0 or later, a Mac with Safari 6.0.5 or later on OS X V10. 8.5 or later, or a PC with Microsoft Edge on Windows 10. Streaming via Apple TV requires an Apple TV (2nd or 3rd generation) with software 6.2 or later or an Apple TV (4th Generat ION).

HLS (HTTP Live streaming) is an HTTP-based media streaming protocol implemented by Apple. Apple's full range of support, because HLS is Apple's proposed, so Apple's full range of products including the iphone, ipad, Safari do not need to install any plug-in to natively support the play HLS, now Android also added to HLS support 。 However, the PC side currently does not support the playback of the protocol except Microsoft Edge, which is not supported by browsers such as Chrome or Firefox.

HLS is very similar to the DASH protocol, by cutting the entire stream into a small media file that can be downloaded via HTTP, and then providing a companion media list file to the client, allowing the client to sequentially pull these media files to play, to achieve the effect that appears to be playing a stream. HLS is now widely used in the field of on-demand and live broadcasting.
<video src="example.m3u8" controls></video>

Using HLS on the HTML5 page

<video controls><source src=“example.m3u8”></source></video>

The advantages of HLS

    • Client support is simple, only need to support HTTP requests, HTTP protocol stateless, only need to sequentially download media fragments.

    • With HTTP protocol network compatibility is good, HTTP packets can also easily through the firewall or proxy server, CDN support is good.

    • With the self-adaptive multi-bitrate, Apple has considered the problem of self-adaptive bitstream when it presents HLS.

The disadvantage of HLS

    • It is difficult to use the interactive broadcast scene compared with the long connection protocol such as RTMP.

    • For on-demand services, because TS tiles are usually small, massive fragmentation can be challenging in terms of file distribution, consistent caching, and storage.

    • While HLS has a significant disadvantage, the cloud also has a corresponding solution.

HLS protocol Detailed


As you can see, HLS has a total of three parts: Serve, CDN, Client. The main content of the HLS protocol is about m3u8, which is very simple to generate and parse, with examples such as:



Simple Media Playlist



Master Playlist with multiple bit rates

HLS Optimization Technology

Because the client each request TS or m3u8 may be a new connection request, so, we can not effectively identify the client, once there is a problem, the basic cannot effectively locate the problem, so the general industrial-level server will be the traditional HLS to make some improvements. This article mainly introduces and hls+ the clouds.
Hls+, also known as streaming HLS technology, is the standard HLS stream processing, significantly reduce the standard HLS delay, H5-end live compatibility is better, and has a small back source, simple system, easy to debug, anti-theft chain, avoid HLS 404 advantages.
1. Variant HLS
First, download a m3u8 file that also pats the cloud:
wget http://uplive.bo.upaiyun.com/live/loading.m3u8
Then, open the downloaded playlist file:


It can be seen that the hls+ also supports this Variant HLS way to identify an HLS connection, and it can be seen that the cloud uses the UUID to represent an HLS connection.

2, HTTP 302
First, request the playback address in HTTP 302.


Open Playlist content:


The address after the jump holds the true playlist, and the UUID can be added to the connection.
In general, either way, eventually we can identify a stream with a unique ID, which allows you to locate problems in the playback process based on this ID when troubleshooting problems.

Four, HLS delay analysis


In order to pursue the low-latency effect, you can cut the slice smaller, take the chip spacing to do smaller, the player does not take 3 pieces to start playback. But these optimizations increase the risk of HLS instability and errors.
V. How to enable HLS to play on devices such as Chrome

Most of the current live streaming uses HTTP (HLS, http-flv) and rtmp protocols for push streaming. We can play through the CDN service, regardless of whether the HTTP or RTMP protocol pushes the stream, and the results are all supported for RTMP, http-flv, and HLS playback.

Demo:

m3u8 Golang Library

(https://godoc.org/github.com/osrtss/rtss/m3u8)

HLS Downloader: Read a m3u8 URL and download it as a TS file.

(Https://github.com/osrtss/rtss/tree/master/m3u8/example/hlsdownloader)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.