Using TTML captions in your XAML/C#-based Windows Store application can be done either in XAML or in the C# code-behind page.

In C#

In the code-behind page for the page containing your Player Framework instance add one line of code in your constructor:

// Constructor
public MainPage()
{
     InitializeComponent();

      // add this line
      MyPlayer.Plugins.Add(new Microsoft.PlayerFramework.TimedText.CaptionsPlugin());
}

Alternatively, In XAML:

1. Add a namespace for the TTML plugin
xmlns:ttmlPlugin="clr-namespace:Microsoft.PlayerFramework.TimedText;assembly=Microsoft.PlayerFramework.TimedText"

2. Add a reference to the plugin inside your Player Framework instance.
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <playerFramework:MediaPlayer x:Name="MyPlayer" Source="http://smf.blob.core.windows.net/samples/videos/RealPCPride.mp4" IsCaptionSelectionVisible="True">
            <playerFramework:MediaPlayer.Plugins>
                <ttmlPlugin:CaptionsPlugin/>
            </playerFramework:MediaPlayer.Plugins>
            <playerFramework:MediaPlayer.AvailableCaptions>
                <playerFramework:Caption Description="English" Source="http://smf.blob.core.windows.net/samples/win8/captions/RealPCPride.en.captions.xml"/>
                <playerFramework:Caption Description="Spanish" Source="http://smf.blob.core.windows.net/samples/win8/captions/RealPCPride.es.captions.xml"/>
            </playerFramework:MediaPlayer.AvailableCaptions>
        </playerFramework:MediaPlayer>
    </Grid>

Last edited Oct 3, 2013 at 12:33 AM by mdowney, version 3

Comments

No comments yet.