Skip to main content

Microsoft Silverlight

Answered Question Where is AudioStreamIndex set???RSS Feed

(0)

sensamecca
sensamecca

Member

Member

2 points

5 Posts

Where is AudioStreamIndex set???

I'm working with some Silverlight examples and we've got it displaying an encoding session just fine.  I was curious where we would set the AudioStreamIndex property.  It seems to reference a MediaElement object, but I don't see one specifically in the code.  We have a player, etc.

 We want bi-lingual support in our player and that means referencing either AudioStreamIndex 1 or AudioStreamIndex 2 in our .js (or XML?) files.  This code we are using is a sample that's been slightly modified.  Does anyone have a JS example of how and where to use this AudioStreamIndex value?

 

Thanks,

d

Justin-Josef Angel [MVP]
Justin-J...

Member

Member

380 points

114 Posts

Answered Question

Re: Where is AudioStreamIndex set???

If I understood you correctly, you're using some sort of ready Silverlight player and want to access It's MediaElement to set some properties.

If you're using on the the Expression Encoder skins you should read Tamir Khason's post on how to customize it:
http://blogs.microsoft.co.il/blogs/tamir/archive/2007/12/18/messed-with-silverlight-video-player-skin-generated-by-encoder-see-how-to-customize-it.aspx

Otherwise, It's just a matter of finding the MediaElement inside the player's JS code and exposing it so you could use it.

---
Justin-Josef Angel
Senior .Net consualtent,
Microsoft Most Valueable Proffesional

Website http://www.JustinAngel.Net
Blog http://blogs.Microsoft.co.il/blogs/JustinAngel
Cell (+972) 546-567789
Office (+972) 03-9504364
Email J@JustinAngel.Net

Got Silverlight 1.0 Javascript Intellisense? www.codeplex.com/intellisense
Got Silverlight 1.1 Hebrew & Arabic? www.codeplex.com/SilverlightRTL

sensamecca
sensamecca

Member

Member

2 points

5 Posts

Re: Where is AudioStreamIndex set???

Does anyone have a sample of where and when to setup an AudioStreamIndex after loading a .wmv file and playing it?

 

We have code that works that reads AudioStreamCount and it does it correctly.  In no way does setting AudioStreamIndex on the same object have any effect.  Is there somehwere specific this needs to be done?  After a particular event or something?  Before a particular event?

kienlua
kienlua

Member

Member

7 points

2 Posts

AudioStreamIndex

Hello everybody,
I have a problem with the property "AudioStreamIndex" of the object "MediaElement".

- I can get the value of AudioStreamCount and I can set AudioStreamIndex.
- But MediaElement does not change the language.

> My codes :


The audio tracks' order is : 1 : FR, 2 : EN, 3 : DE


1) When the state of the video change, I call the function "video_CurrentStateChanged" :
this.video.CurrentStateChanged += new RoutedEventHandler(video_CurrentStateChanged);

2) In my function "video_CurrentStateChanged", if the video's state is Playing,
I set the AudioStreamIndex with the value "2" for example (2 = EN : English)

private void video_CurrentStateChanged(object sender, RoutedEventArgs e)
{  
    if (this.video.CurrentState == "Playing")
   {
        this.video.AudioStreamIndex = 2;
    }
}

3) The video's audio is always in French (FR)

Do you have any ideas about this problem?

Thank you everyone for your responses,

anil_litam
anil_litam

Member

Member

558 points

262 Posts

Re: Where is AudioStreamIndex set???

 Go through the following link..

http://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement.audiostreamindex%28VS.95%29.aspx

kienlua
kienlua

Member

Member

7 points

2 Posts

Re: Re: Where is AudioStreamIndex set???

Hi anil_litam,

Have you ever had the same problem when using the attribut AudioStreamIndex?

anil_litam
anil_litam

Member

Member

558 points

262 Posts

Re: Re: Where is AudioStreamIndex set???

 Actually i never worked for this.

But the link i given Microsoft is showing how could you set the property...

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities