Alternative audio switching is supported with Dolby.io with the support of Multi Source Broadcasting.
When a second audio only stream source is broadcasting, the source will become active in an audio language tracks menu.
Using an audio mixer feature the main audio can be mixed with the second selected audio using a config mixAudio
and main audio level changed using a config switchedMainVolume
and the language track audio volume is set with switchedLangVolume
. Or switched between tracks.
To prepare for multi language track support the main source name can be configured to anything. For the seperate audio language track the source name needs to be set with a prefix of lang_audio_
and the language code ie lang_audio_de
. The language code will be parsed and a label created. Or set the source name as the language label.
The main source id to use for publishing has no source id
NrD6zA75oEgY?t=token&simulcastId&sourceId=0
The second source id for publishing will be displayed in the console ie. audioOnly
param is required on the publish stream name.
NrD6zA75oEgY%3Ft%3Dtoken%3Dlang_audio_de%26audioOnly"
For the audio language track to work an audio only stream is required to be published with no video.
ffmpeg -re -i audio/eng.wav -c:a aac -f mpegts "srt://srt-auto.millicast.com:10000?streamid=NrD6zA75oEgY%3Ft%3Dtoken%3Dlang_audio_de%26audioOnly"
{
"rtcsubscriber": {
"dolbyio": {
"accountId": "",
"subToken": ""
}
}
}
<div class="flex w-full h-auto my-auto">
<video class="video-js vjs-default-skin vjs-fluid " crossorigin="anonymous" controls="" id="dolbyio-altaudio"></video>
</div>
<script type="text/javascript">
var player = videojs("dolbyio-altaudio", {
"live": true,
"plugins": {
"qualitymenu": {},
"rtcsubscriber": {
"altaudio": true,
"dolbyio": {
"accountId": "huaHNT"
},
"mainAudioLang": "en",
"mixAudio": true,
"server": "dolbyio",
"switchedLangVolume": 0.6,
"switchedMainVolume": 0.5
}
},
"sources": [
{
"src": "NrD6zA75oEgY",
"type": "application/webrtc"
}
]
});
</script>