Since 2020, browser development and compatibility have changed, WebRTC’s latency and security have been improved and protected, especially after the outbreak of the virus, the demand for real-time video has increased 30 times than before, which further stimulated the rapid development of WebRTC products. So we also realized WebRTC protocol playback in EasyGBS, EasyDSS and other platforms.
Some EasyCVR customers need a low-latency cloud solution, so we also added WebRTC playback protocol in EasyCVR. After analyzing this requirement, we learned that this function could be implemented by simply returning the WebRTC’s play address at the time the play is requested.
Add the following code to return the corresponding playback address according to the requested playback protocol. When the front end transmits WebRTC, the back end returns the playback address beginning with WebRTC ://, and then directly returns the video stream data when the front end requests playback.
VideoCode = 0xae ack.EasyDarwin.Body["ChannelName"] = gbschannels[0].ID ack.EasyDarwin.Body["DeviceType"] = "GB" ack.EasyDarwin.Body["DeviceID"] = dev ack.EasyDarwin.Body["ChannelID"] = gbschannels[0].Index ack.EasyDarwin.Body["RealTimeRecord"] = realtimeRecord ack.EasyDarwin.Body["Codec"] = VideoCode Ack.easydarwin.Body["SnapURL"] = value.snapurl () ShareAuth := utils.conf ().section ("base_config").key ("share_auth").mustbool (false) if shareAuth { if value.Token ! = token { ack.EasyDarwin.Body["URL"] = "" ack.EasyDarwin.Body["Token"] = ""Copy the code
The front end requests WebRTC to play again, and it can play normally: