There is an HTML5 player that supports the M3U8 format

Author: Pu Xiaohua
Link: https://www.zhihu.com/question/21087379/answer/252216119
Source: Zhihu
The copyright belongs to the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.
 

I recently came into contact with this piece, so let’s briefly talk about it.

m3u8 is a file video format based on HTTP Live Streaming , which mainly stores the basic information and segments of the entire video. Currently, the HLS protocol first proposed by Apple.inc is natively supported on Mac Safari. You can directly pass

video.src = 'xxx.m3u8'

to realise.

If you want to be compatible with all browsers, you need to know about the Media Source Extensions supported by Chrome and Firefox (very unsatisfactory, in IE and China's extremely fast browsers with compatibility mode):

 

At present, mainstream video websites such as Youtube and Netflix, even the videos in FB's newsfeed adopt the HLS solution. The general implementation process is as follows:

 

Its core lies in the file parsing of m3u8 and the acquisition of fragmented content binary files through XHR, and then use MSE's appendBuffer to encapsulate the buffer, and then complete the confluence work by itself.

 

Currently in China, bilibili is the first to implement a player based on the MSE solution. Probably why they have to use MSE instead of the multi-video solutions of Youku and Tencent. It may be that the money is less, and video conversion to MP4 requires a large number of servers. Of course, MSE is technical. trend.

 

There is too much nonsense in the front to recommend it directly:

 

The video.js solution is recommended first, because it supports multiple playback cores, and there are many plugins, you only need to use

videojs/videojs-contrib-hls will do just fine.

Another very pure solution of Amway is hls.js , which requires you to bind the video by hand.

A player also open sourced by 75 Team: Chimeejs/chimee

 

Of course, our team will also open source a playback core similar to youtube.

 

Yes ,
safari's h5 natively supports hls (m3u8) to play
chrome and other browsers, you need to write and decode by yourself, refer to this videojs/videojs-contrib-hls · GitHub
That is to say, HTML5 Video Player can install the videojs-contrib-hls plug-in.



Author: Zhihu User
Link: https://www.zhihu.com/question/21087379/answer/41506906
Source: Zhihu
The copyright belongs to the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324455868&siteId=291194637