I am developing a WebOS IPTV application, and some channels have multiple audio tracks. I am facing an issue with audio track switching—when I change the audio using videoElement.audioTracks
, the sound does not change. I want to know whether videoElement.audioTracks
is supported on WebOS.
The audioTracks attribute is supported on webOS TV 3.0 and higher, and you can use it as follows:
function selectTrack(index) {
var audioTracks = document.getElementById('myVideo').audioTracks;
for (var i = 0; i < audioTracks.length; i++) {
if (i == index)
audioTracks[i].enabled = true;
else
audioTracks[i].enabled = false;
}
}