声音通道
Task: To organize the separation of the left and right channels in the player (stereo to mono).
Customer: «For example, there is a broadcast in two languages and we want to transmit one stream with different languages on the left and right channels, and in the player already to divide.»
Channel selection is enabled in the menu Elements / Settings window
Also you need to enable Plugins / Channels with PRO
Channel selection will be in the settings menu. You can change all the names in the builder and remove the mixed (stereo) mode.
You can assign a default channel with the default_channel parameter in the player code.
0 left, 1 right, 2 stereo
var player = new Playerjs({id:"player", file:"stream.m3u8", default_channel:1});
Features and limitations
- Channel switching works for video, audio files, for HLS and DASH.
- Channel management requires cross-domain permission if content is loaded from another domain. Files may require server configuration — the header should contain Access-Control-Allow-Origin: * and the
Services / Cross-domain (CORS) option is enabled in the settings. If the video plays muted, then something is wrong with the cross-domain policy (look in the browser console). For HLS and DASH streams everything is usually already set up and no manipulations are needed.
- According to the rules of modern browsers, data processing requires user initiation. Therefore, the channel selection appears only after the user has launched the player.
- Channel selection requires the browser to support the Web Audio API, so it may not work in older versions of browsers and Internet Explorer.
- You can add custom elements for creating separate listing or switch channels using JS API with command api:channel,1