HTML5 video Live (i) (EXT)

Source: Internet
Author: User

HTML5 video Live (i)It Community referral information-itindex.netAPR

Recently, I met the demand of live video on mobile WEB, researched the related technology and recorded it.

At present, the mainstream video streaming program on the web has HLS and RTMP, the mobile Web side is currently only HLS can be used, we focus on it.

HTTP Live Streaming

HTTP Live Streaming (HLS) is an HTTP-based video streaming protocol, implemented by Apple, with QuickTime, Safari, and Safari on Mac OS supporting HLS, high-version Android The OID also adds support for HLS. Some common clients such as: Mplayerx, VLC also support HLS protocol.

The HLS protocol is based on HTTP, very simple. A server that provides HLS needs to do two things:

    • Encoding: Encode the image in h.263 format, encode the sound MP3 or HE-AAC, and eventually package it into a MPEG-2 TS (Transport Stream) container;
    • Segmentation: The encoded TS file is divided into small files with a suffix of TS, and a. m3u8 Plain text index file is generated;

The browser is using the m3u8 file. M3U8 is similar to the audio list format m3u, you can simply think of m3u8 as a playlist with multiple TS files. Players are played in order, all finished and then request the m3u8 file, to get the playlist containing the latest TS files to continue to broadcast, cycle by. The entire live process relies on a constantly updated m3u8 and a bunch of small TS files, m3u8 must be updated dynamically, TS can go CDN.

You can see the nature of the HLS protocol or an HTTP request/response, so the adaptability is good, not affected by the firewall. But it also has a deadly weakness: The delay is very obvious. If each TS is segmented by 5 seconds, and a m3u8 puts 6 TS indexes, at least a 30-second delay is generated. If you reduce the length of each TS, reduce the number of indexes in the m3u8, the latency will actually decrease, but will lead to more frequent buffering, and the request pressure on the server will multiply. Therefore, only need to find a compromise point according to the actual situation.

For HLS-enabled browsers, this can be played directly:

  <video src="http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"height="300" width="400"></video>

For browsers that do not support m3u8, such as Chrome on Pc/mac, it needs to be implemented with Flash. Some of the more mature programs on the Web can be used directly, such as: Sewise player (free), JW player (charge).

Real Time Messaging Protocol

Real time Messaging Protocol (RTMP) is a set of video live protocols developed by Macromedia and now belongs to Adobe. This package requires a dedicated RTMP streaming service such as Adobe Media Server, and only Flash implementation player can be used in the browser. Its real-time nature is very good, the delay is very small. But the inability to support mobile WEB playback is its mishap.

The previously mentioned JW player can play a very good live streaming service using the RTMP protocol.

This time to write so much, the next one to write an alternative live program.

This article link: https://www.imququ.com/post/html5-live-player-1.html

--eof--

HTML5 video Live (i) (EXT)

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.