The invention provides a voice monitoring
intercom system front-end
interaction method compatible with H.265 and H.264, which needs to build a three-layer
system framework in advance, and comprises a
core component layer, a
functional module layer and an external dependency layer. The
core component layer comprises a Player component and a Video component, and the
functional module layer comprises a
WebRTC connection management module, a media
stream processing module, a decoding and playing module and a decoding and playing module; the external dependency layer comprises a
WebRTC API (Application Program Interface) used for signaling and media
stream processing, WebCoodecs used for hard decoding, a WebGL (
Web Graphics Library) used for video rendering and an external decoder used for soft decoding; the method comprises the following steps: creating a player instance, and initializing parameters; establishing connection; after receiving the audio or video track, selecting a corresponding decoding mode according to the coding format; creating a video interface; and calling a story method to clean a media track, a decoder, a
data channel and connection, and releasing all resources. According to the invention, the native two-way communication is realized, the stability and reliability of the
system are improved, the support for the H.265 / H.264 double-coding format is realized, and the transmission efficiency is improved.