none
Enumerate Audio Tracks in SMF player

    Question

  • I am playing Windows Media File in SMF Player . File having multiple audio tracks , I want to change audio tracks via progmamming .  How can I achieve that task 


    rajesh think

    Saturday, August 03, 2013 11:30 AM

Answers

  • Hello,

    Silverlight provides a dedicated AudioStreamIndex API on MediaElement, so that the Silverlight application author can use Silverlight programming techniques to select which audio channel to play for the user.

    To change audio tracks, please try to use AudioStreamCount to check the audio track number, and then make sure AudioStreamIndex is set within 0 - count-1.

    private void AltAudioBtn_Click(object sender, RoutedEventArgs e)
            {
                if (media.AudioStreamCount > 1)
                {
                    if (media.AudioStreamIndex == 1)
                    {
                        media.AudioStreamIndex = 0;
                        (sender as Button).Content = "Play full-description audio";
                    } else {
                        media.AudioStreamIndex = 1;
                       (sender as Button).Content = "Play default audio";
                    }
                }
                else
                {
                    (sender as Control).IsEnabled = false;
                }
            }

    For details about Accessing Alternate Audio Tracks in Silverlight Media please refer:

    http://www.w3.org/WAI/GL/WCAG20-TECHS/SL1.html

    Hope this helps, thanks.


    Yanping Wang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, August 06, 2013 8:14 AM