Page 1 of 1

Reading audio stream information with Mozilla/ActiveX plugin

Posted: 05 Dec 2006 16:06
by Spellcoder
I'd like to have the ability get information about available audio-streams (in my case from DVD) with the browser plugin.

Posted: 06 Dec 2006 03:10
by The DJ
This is something that will be worked on quite soon.

Posted: 08 Dec 2006 10:06
by Spellcoder
That's great, thank you for the answer. :D (bedankt!)

Posted: 11 Dec 2006 09:25
by zvona
I'll second that request for both audio- and subtitle-tracks.

Posted: 12 Dec 2006 20:22
by The DJ
audio track is implemented now:

http://trac.videolan.org/vlc/changeset/18383

Posted: 05 Jan 2007 14:01
by Spellcoder
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.

Posted: 30 May 2007 15:23
by Spellcoder
I'll try to make some more arguments for getting info about audio-streams with the activeX/mozilla-plugin. Hopefully somebody is interesting in implementing it.

Getting and setting the current selected audio-stream works. However there's no way to get any information about the audio-streams. I think it's important to be able to know
  • if a audio-stream (track) exists
  • for which language an audio-stream is
As long as it's not possible with the browser plugin you get these issues, when trying to play DVD's (or multi-language videos/streams):
  • to look which streams there are you have to use try{} catch(err){} to see which streams exist
  • if you use the VLC plugin for a specific DVD you have to hardcode the the order of the audio tracks in your javascript
  • if you have a multiple DVD project you have to take into account the order of audio tracks can be different on each DVD
  • the order of audio-tracks sometimes even differ according to the start-time you use as option. (or can you change language of an audio streams per chapter?? otherwise it seems a bug to me)
  • if you're making a general DVD player you have to make the user click on audio-stream numbers, making them guess the number for their language
All of these problems could be solved if we have access to the language-info (for example the 2/3-lettercodes of the language in an audio-stream). So is anyone up for adding functionality for getting info about available streams with the browser plugin? (you'll be my hero :P)

Maybe something like:
  • streamExists = objVLC.audio.tracklist.[ streamID ]
    If it's defined that audio track exists
  • langCode = objVLC.audio.tracklist.[ streamID ].language
    This would return the two or three letter country code (as also used in the command-line option :audio-language).