current position:Home>How does HTML5 implement live streaming? It's worth learning!

How does HTML5 implement live streaming? It's worth learning!

2022-06-24 08:38:45Tsingsee green rhino video

since RTMP Since the birth of Streaming Protocol , rely on RTMP The streaming development of the protocol has never stopped , Before finding a better alternative , The mainstream of the market will still be pushed by RTMP Protocol to implement . As the public knows ,PC End web The mainstream live video scheme has always been RTMP, Including what we developed EasyCVR platform , It also supports... In the latest version RTMP Push the flow , However, this version is currently being tested , After the test, it will go online , You can pay attention to .

The focus of this article is still on HTML5 On the live streaming of the video . With the explosive growth of live broadcasting platform ,H5 The demand for live broadcasting has also become extremely rich . adopt H5 The overall process of live broadcasting is roughly divided into three modules :

Video capture : The module includes audio and video equipment on the acquisition computer 、 Mobile phone camera and microphone 、 television / Audio and video of the game scene camera, etc , about H5 Live streaming of , The main direction of collection is still the audio and video collection of camera on mobile terminal and TV station .

Decode and distribute : The module is mainly completed by the video streaming media server , After video capture, one Nginx Server to process , Collect the video stream transmitted by the video recording end (H264/ACC code ), It is parsed and encoded by the server , push RTMP/HLS Stream the format video to the video player .

Video playback : Video playback depends on the player used by the user , Including computer player 、 Mobile player and H5 Of video label .

And for PC End H5 Video recording for , You can choose more advantageous webrtc technology , Use WebRTC The basic process of video recording is simple :

1、 call window.navigator.webkitGetUserMedia(), Get the user's PC Camera video data .

2、 Convert the acquired video stream data into window.webkitRTCPeerConnection( A video stream data format ).

3、 utilize WebScoket Transmit the video stream data to the server .

After recording the video , You need a set RTMP Live streaming service to ensure the transmission of video stream , At the same time, it also has the function of converting live stream format and encoding streaming , When the server receives the video stream transmitted from the capture video recording end , It needs to be parsed and encoded , push RTMP/HLS Stream the format video to the video player .

We said that before , There are many ways to obtain a set of streaming media service platform , Including building from scratch 、 Use the open source platform as the infrastructure for modification 、 Directly find a reliable third-party organization to obtain the platform , It takes time and effort to build your own platform , Therefore, it is recommended to use the open source platform or directly find a service provider to complete .

TSINGSEE Green rhinoceros video has independent EasyDarwin Open source platform , Can help developers easily build streaming media services , at present EasyDarwin The platform has a stable operating environment and professional technical support , These two advantages are the strong backing of users in the process of use . At the same time, we have EasyDSS In this way RTMP Live on demand platform , After installation and deployment, video streaming can also be realized H5 Push the live streaming , And as an open commercial streaming media solution ,EasyDSS It also has a very rich secondary development interface , Can be very simple for secondary development and Application .

copyright notice
author[Tsingsee green rhino video],Please bring the original link to reprint, thank you.

Random recommended