Access AudioStreams and Captions

Sep 3, 2010 at 8:06 AM


When I load a mp4 video, I want to access to different AudioStreams and Captions.

But, after the loaded event the properties AvailableAudioStreams and AvailableCaptionStreams are empty.

I checked that the video contains AudioStreams this way :

CurrentMediaElement = this.MediaPresenterElement.Content as MediaElement;

And the property AudioStreamCount is 2.

Why the properties AvailableAudioStreams and AvailableCaptionStreams are empty?



Aug 26, 2011 at 10:16 AM
Edited Aug 26, 2011 at 10:26 AM

I've got the same issue here with WMV files.

I guess this means I have to populate the version list myself instead of relying on SMF here, or is there anything else to do?

UPDATE: after looking at the source, it's obvious it won't work:

private void UpdateAvailableAudioStreams()
        AvailableAudioStreams = ActiveAdaptiveMediaPlugin != null
                                && ActiveAdaptiveMediaPlugin.CurrentSegment != null
                                && ActiveAdaptiveMediaPlugin.CurrentSegment.AvailableStreams != null
                                    ? ActiveAdaptiveMediaPlugin.CurrentSegment.AvailableStreams
                                            .Where(i => i.Type == StreamType.Audio)
                                            .Select(i => new StreamMetadata
                                                                Id = i.Id,
                                                                Attributes = i.Attributes
                                            .OrderBy(i => i.Name)
                                    : Enumerable.Empty<StreamMetadata>();
    catch (Exception err)
        string message = string.Format(SilverlightMediaFrameworkResources.GenericErrorOccurredLogMessage,
                                        "OnMediaOpened", err.Message);
        SendLogEntry(KnownLogEntryTypes.GeneralErrorOccurred, LogLevel.Error, message);