Problem aligning subtitles

Sep 24, 2012 at 8:36 AM

I'm using Silverlight and the Microsoft Media Framework to play video streams on a live broadcasting service. For some reason I cannot get the subtitles to align properly in the player. The subtitles is aligned at top left in the player. I add the subtitles using the following code:
 
var markerResource = new MarkerResource();
markerResource.Source = new Uri(subtitleUrl, UriKind.Absolute);               
playlistItem.MarkerResources.Add(markerResource);

An example of an xml-file that the subtitleUrl:

<?xml version="1.0" encoding="utf-8"?>
<tt xmlns="http://www.w3.org/ns/ttml" xmlns:ttp="http://www.w3.org/ns/ttml#parameter" ttp:timeBase="media" xmlns:tts="http://www.w3.org/ns/ttml#style" xml:lang="en" xmlns:ttm="http://www.w3.org/ns/ttml#metadata">
  <head>
    <metadata>
      <ttm:title>261814SW</ttm:title>
    </metadata>
    <styling>
      <style id="s0" tts:backgroundColor="black" tts:fontStyle="normal" tts:fontSize="16" tts:fontFamily="sansSerif" tts:color="white" />
    </styling>
  </head>
  <body style="s0">
    <div>
      <p begin="00:01:29.920" id="p0" end="00:01:36.240">Testing</p>
    </div>
  </body>
</tt>

Since we are using subtitle files from another system we are not able to modify the xml or the styling element in it before we receive it.
 
My first thought was to modify the ItemTemplate and the CaptionBlockRegion in the CaptionsPresenter. This however showed to be more problematic than we first thought since Blend do not allow us to do that.
 
Does anybody have any suggestion on how to style the subtitles so that they are centered in the bottom part of the screen? The only way we can think of is to modify the xml after it has been downloaded, but that doesn’t really feel like the most intuitive way to solve the problem. Isn’t there any more straight forward way this can be achieved using Silverlight and xaml?
 
Any suggestion or advice on the subject is highly appreciated!
 
Regards,
Jonas