I am trying develop a silverlight player based on SmoothStreamingMediaElement. For Ref: SSME:SmoothStreamingMediaElement Grid.Row="2" x:Name="medSmooth" AutoPlay="True" MinWidth="320" MinHeight="240""
Now the Source Smooth Streams are encoded using H.264 video codec and AAC as Audio codec. I found at below URL, that audiostreamindex and audiostreamcount properties are for WMV type only and that killed my only left hope. http://msdn.microsoft.com/en-us/library/microsoft.web.media.smoothstreaming.smoothstreamingmediaelement_properties(v=vs.90).aspx
Can any body help me on How I can detect the currently playing language in video, and then I want to put an event handler or "Users action of changing language", once that event i s fired, I want to change the currently playing audio track to the selected one.
I suggest to use Silverlight Media Framework, it really simplifies development of video applications. You can download its source code here: http://smf.codeplex.com/downloads/get/386528.
However, you can do some things without framework
Here is the code:
var currentSegment = mediaElement.ManifestInfo.Segments[mediaElement.CurrentSegmentIndex.Value];
var currentAudioStream = currentSegment.SelectedStreams.Where(i => i.Type == MediaStreamType.Audio).FirstOrDefault()
Something like this:
foreach (var segment in mediaElement.ManifestInfo.Segments)
{
var newStreams = new List<StreamInfo>();
// use current video streams
var selectedVideoStreams = segment.SelectedStreams.Where(i => i.Type != MediaStreamType.Audio).ToList();
newStreams.AddRange(selectedVideoStreams);
// add a new audio stream
newStreams.Add(newAudioStream);
// replace old streams by new ones
segment.SelectStreamsAsync(newStreams);
}