Reading the current audio-stream ID ( = objVLC.audio.track ) and setting the audio stream (objVLC.audio.track=) works great in the 0.9.0 nightly ! (thanks!)
I have some futher requests too, because although setting audio tracks during playing was on my wishlist it doesn't give information about available audio-streams.
So I'll elaborate on what I had in mind:
Getting a list of all audio streams
Will we also get the ability to get information about the audio streams?
For example I think it would be usefull to be able to have a method that gives back an array with all streams.
Some reasons why I think it's usefull:
- making a pulldown for selecting an audio stream
- for when you prefer a language but if it's not available, fall back to the english audio stream
An simple example of how the array could be used would be:
(this would (if it exists) select the audio-stream in the preferred language and otherwise it will select the english audio-stream)
Code: Select all
var objVLC = document.getElementById('objVLC');
var tracklist = objVLC.audio.trackList;
var prefLang = 'nl';
var prefLangAvailable = false;
for(var trackID in tracklist) {
if (tracklist[trackID] == prefLang) prefLangAvailable = true;
}
var useLang = prefLangAvailable ? prefLang : 'en';
var options = ':audio-language='+useLang;
objVLC.playlist.clear();
objVLC.playlist.add(URI,null,options);
objVLC.playlist.play();
Setting audio stream by language code
Also with the playlist.add options you can use :audio-language=en. It might be usefull to use these language codes too for setting an audio-stream.
Something like:
objVLC.audio.track = 'de';
or
objVLC.audio.track = objVLC.audio.getTrackIDByLanguage('de');
or
objVLC.audio.setTrackByLanguage('de');
However it won't be necessary perse anymore if the objVLC.audio.tracklist was implemented.