Captions not working

Nov 1, 2011 at 9:24 AM

Hi,

I have problems displaying captions for my smooth stream.

I use these test-captions from another forum-post:

<?xml version="1.0" encoding="utf-8" ?>
<tt xml:lang="en-GB" xmlns="http://www.w3.org/2006/10/ttaf1">
  <head>
    <metadata>
      <ttm:title xmlns:ttm="http://www.w3.org/2006/10/ttaf1#metadata" />
      <ttm:desc xmlns:ttm="http://www.w3.org/2006/10/ttaf1#metadata" />
      <ttm:copyright xmlns:ttm="http://www.w3.org/2006/10/ttaf1#metadata" />
    </metadata>
    <styling>
      <style xml:id="backgroundStyle" p5:fontFamily="proportionalSansSerif" p5:fontSize="16px" p5:textAlign="center" p5:origin="10% 85%" p5:extent="80% 10%" p5:backgroundColor="rgba(0,0,0,100)" p5:displayAlign="center" xmlns:p5="http://www.w3.org/2006/10/ttaf1#styling" />
      <p5:style xml:id="speakerStyle" p5:style="backgroundStyle" p6:color="white" p6:backgroundColor="transparent" xmlns:p6="http://www.w3.org/2006/10/ttaf1#styling" xmlns:p5="http://www.w3.org/2006/10/ttaf1" />
    </styling>
    <layout>
      <p5:region xml:id="speaker" p5:style="speakerStyle" p6:zIndex="0" xmlns:p6="http://www.w3.org/2006/10/ttaf1#styling" xmlns:p5="http://www.w3.org/2006/10/ttaf1" />
      <p5:region xml:id="background" p5:style="backgroundStyle" p6:zIndex="0" xmlns:p6="http://www.w3.org/2006/10/ttaf1#styling" xmlns:p5="http://www.w3.org/2006/10/ttaf1" />
    </layout>
  </head>
  <body>
    <div>
      <p4:p p4:region="speaker" p4:begin="00:00:05:00" p4:end="00:00:10.500" xmlns:p4="http://www.w3.org/2006/10/ttaf1">Test caption? </p4:p>
      <p4:p p4:region="speaker" p4:begin="00:00:12:00" p4:end="00:00:15:000" xmlns:p4="http://www.w3.org/2006/10/ttaf1">How do you like this test caption? </p4:p>
    </div>
  </body>
</tt>

 

This is my code:

  public void PlayStream(string streamUri)
        {
            Playlist.Clear();
            MarkerResource testMarkerResource = new MarkerResource();

            testMarkerResource.Format = "TTAF1-DFXP";
            testMarkerResource.Source = new Uri("samplecaptions.xml", UriKind.Relative);

            var pi = new PlaylistItem {MediaSource = new Uri(streamUri), DeliveryMethod = DeliveryMethods.AdaptiveStreaming};
            pi.MarkerResources.Add(testMarkerResource);
            CaptionsVisibility = FeatureVisibility.Visible;

            Playlist.Add(pi);
            Play();
        }

Nothing is showing up and I can't see any requests going out to read the captions XML file.
Any ideas or suggestions are highly appreciated!

Thanks,
Rob

Nov 3, 2011 at 12:45 PM

One step in the right direction was to add the plugins to the project:

Microsoft.SilverlightMediaFramework.Plugins.TimedText
Microsoft.SilverlightMediaFramework.Plugins.ClearTextCaptions

Now I can see that the external captions file IS loading, but still nothing is visible on screen :/

Nov 3, 2011 at 11:24 PM
Edited Nov 3, 2011 at 11:32 PM

Hi Rob,

I've been have problems too with this aspect, but fortunately I was able to resolve the subtitle reproduction.

First of all make sure you are working with the SMF Player version 2.5 (You can check this by navigating with Windows Explorer to C:\Program Files (x86)\Microsoft SDKs\Microsoft Silverlight Media Framework\v2.5).

Then in Expression Blend (I use version 4) create a new Silverlight aplication + web site, and in the project add the following libraries: 

From Microsoft Silverlight Media Framework v2.5:

Microsoft.SilverlightMediaFramework.Core.dll

Microsoft.SilverlightMediaFramework.Plugins.SmoothStreaming.dll

Microsoft.SilverlightMediaFramework.Plugins.TimedText.dll

Microsoft.SilverlightMediaFramework.Plugin

Microsoft.SilverlightMediaFramework.Utilities.dll

AND FROM IIS Smooth Streaming Client (C:\Program Files (x86)\Microsoft SDKs\IIS Smooth Streaming Client\v1.5\Silverlight)

Microsoft.Web.Media.SmoothStreaming.dll

 

Then add a SMF Player control from the asset panel and set the playlist items like this:

 

 

<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:smf="http://schemas.microsoft.com/smf/2010/xaml/player" xmlns:smf_media="http://schemas.microsoft.com/smf/2010/xaml/media"
	x:Class="saPlayerLibreriasOK.MainPage"
	Width="640" Height="480">

	<Grid x:Name="LayoutRoot" Background="White">
		<smf:SMFPlayer Margin="8">
			<smf:SMFPlayer.Playlist>
				<smf_media:PlaylistItem MediaSource="http://localhost/TEATRA/videos/3/TEATRA_DEMO_sp.ism/manifest" DeliveryMethod="AdaptiveStreaming">
					<smf_media:PlaylistItem.MarkerResources>
						<smf_media:MarkerResource Source="http://localhost/TEATRA/videos/3/TEATRA_DEMO.spa.capt.dfxp"/>
					</smf_media:PlaylistItem.MarkerResources>
				</smf_media:PlaylistItem>
			</smf:SMFPlayer.Playlist>
		</smf:SMFPlayer>
	</Grid>
</UserControl>

 

 

Save your project, and check your IIS 7.0

 

Tip: there are a problem with the font size, in your dfxp file change 1.5c to 16px (or whatever you wish)

 

Final TIP for IIS

 

You must have installed IIS Media Services (this link may be usefull: http://learn.iis.net/page.aspx/1046/iis-media-services-readme#installation)

 

And you  must have two xml files in your server root directory (see an example bellow):

 

C:\inetpub\wwwroot

 

crossdomain.xml

 

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

 

clientaccesspolicy.xml

 

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
    <cross-domain-access>
        <policy>
            <allow-from http-request-headers="*">
                <domain uri="*"/>
            </allow-from>
            <grant-to>
                <resource path="/" include-subpaths="true"/>
            </grant-to>
        </policy>
    </cross-domain-access>
</access-policy>

I hope this information be helpful for you

 

Pablo Osés

Eventa SRL

Visit teatra.co

Nov 3, 2011 at 11:32 PM
Edited Nov 3, 2011 at 11:33 PM

Sorry I forgot one more library to add (I edit the main post)

 

From Microsoft Silverlight Media Framework v2.5:


Microsoft.SilverlightMediaFramework.Plugin

 

Regards

 

Pablo Osés

Nov 7, 2011 at 2:33 PM

Thanks PabloOses, it looks like my libraries are up to date, but still no captions :/

Nov 7, 2011 at 7:05 PM

Hi Rob, I already try with the xml subs from your first post, and it´s works replacing int the example (so the format in the sub fiel it´s correct):

<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:smf="http://schemas.microsoft.com/smf/2010/xaml/player" xmlns:smf_media="http://schemas.microsoft.com/smf/2010/xaml/media"
	x:Class="saPlayerLibreriasOK.MainPage"
	Width="640" Height="480">

	<Grid x:Name="LayoutRoot" Background="White">
		<smf:SMFPlayer Margin="8">
			<smf:SMFPlayer.Playlist>
				<smf_media:PlaylistItem MediaSource="http://localhost/Teatra/videos/3/video3_sp.ism/manifest" DeliveryMethod="AdaptiveStreaming">
					<smf_media:PlaylistItem.MarkerResources>
						<smf_media:MarkerResource Source="http://Teatra/videoparadise/videos/3/robsubs.xml"/>
					</smf_media:PlaylistItem.MarkerResources>
				</smf_media:PlaylistItem>
			</smf:SMFPlayer.Playlist>
		</smf:SMFPlayer>
	</Grid>
</UserControl>
 

http://twitpic.com/7bvrvg/full

 

But, just in case, try adding the .dfxp mime type  (text/xml) to IIS for your current application.

 

http://twitpic.com/7bvs6x/full

 

 

Regards,

 

Pablo

Nov 9, 2011 at 12:10 PM

Thanks PabloOses, I got the captions working now. There was some elements missing in my CaptionsPresenterElement!
The (final) problem is that I have a black bar under the captions text/background. I don't yet know how to remove it :P

My CaptionsPresenterElement:

<smf_accesscontrols:CaptionsPresenter x:Name="CaptionsPresenterElement" HorizontalContentAlignment="Stretch" ItemsSource="{TemplateBinding VisibleCaptions}" VerticalContentAlignment="Stretch" BorderThickness="0" Margin="0,0,0,40" Foreground="#FF55C01B">
								
								<smf_accesscontrols:CaptionsPresenter.ItemsPanel>
									<ItemsPanelTemplate>
										<Grid/>
									</ItemsPanelTemplate>
								</smf_accesscontrols:CaptionsPresenter.ItemsPanel>
								
								<smf_accesscontrols:CaptionsPresenter.ItemTemplate>
									<DataTemplate>
										<smf_accesscontrols:CaptionBlockRegion CaptionRegion="{Binding}"/>
									</DataTemplate>
								</smf_accesscontrols:CaptionsPresenter.ItemTemplate>
							
							</smf_accesscontrols:CaptionsPresenter>

Feb 14, 2012 at 12:37 PM
robbanp wrote:

Thanks PabloOses, I got the captions working now. There was some elements missing in my CaptionsPresenterElement!
The (final) problem is that I have a black bar under the captions text/background. I don't yet know how to remove it :P

My CaptionsPresenterElement:

 

<smf_accesscontrols:CaptionsPresenter x:Name="CaptionsPresenterElement" HorizontalContentAlignment="Stretch" ItemsSource="{TemplateBinding VisibleCaptions}" VerticalContentAlignment="Stretch" BorderThickness="0" Margin="0,0,0,40" Foreground="#FF55C01B">
								
								<smf_accesscontrols:CaptionsPresenter.ItemsPanel>
									<ItemsPanelTemplate>
										<Grid/>
									</ItemsPanelTemplate>
								</smf_accesscontrols:CaptionsPresenter.ItemsPanel>
								
								<smf_accesscontrols:CaptionsPresenter.ItemTemplate>
									<DataTemplate>
										<smf_accesscontrols:CaptionBlockRegion CaptionRegion="{Binding}"/>
									</DataTemplate>
								</smf_accesscontrols:CaptionsPresenter.ItemTemplate>
							
							</smf_accesscontrols:CaptionsPresenter>

 

 

Hi,

I've the same problem (the black bar under captions, but it isn't visible if captions coming from stream), my code is identical to yours, do you have resolved it? (I'm using smf 2.6). It seems like if there are two captions sections when I try to take captions from external file.

Thanks,

Daniele Impellizzeri

 

Feb 14, 2012 at 4:35 PM
Edited Feb 14, 2012 at 4:37 PM

Hi Daniele, could you post a screen capture of the black bar?

Perhaps if you are using an dfxp.ismt subtitle file there are some format options into the header tag:

 

 

<?xml version="1.0" encoding="utf-8"?>
<tt xml:lang="es" xmlns="http://www.w3.org/2006/10/ttaf1">
  <head>
    <metadata>
      <ttm:title xmlns:ttm="http://www.w3.org/2006/10/ttaf1#metadata" />
      <ttm:desc xmlns:ttm="http://www.w3.org/2006/10/ttaf1#metadata" />
      <ttm:copyright xmlns:ttm="http://www.w3.org/2006/10/ttaf1#metadata" />
    </metadata>
    <styling>
      <style xml:id="backgroundStyle" p5:fontFamily="proportionalSansSerif" p5:fontSize="26px" p5:textAlign="center" p5:origin="0% 92%" p5:extent="100% 8%" p5:backgroundColor="rgba(0,0,0,75)" p5:displayAlign="center" xmlns:p5="http://www.w3.org/2006/10/ttaf1#styling" />
      <style xml:id="speakerStyle" p5:style="backgroundStyle" p6:color="yellow" p6:textOutline="0px 1px" p6:backgroundColor="transparent" xmlns:p6="http://www.w3.org/2006/10/ttaf1#styling" xmlns:p5="http://www.w3.org/2006/10/ttaf1" />
    </styling>
    <layout>
      <region xml:id="speaker" p5:style="speakerStyle" p6:zIndex="1" xmlns:p6="http://www.w3.org/2006/10/ttaf1#styling" xmlns:p5="http://www.w3.org/2006/10/ttaf1" />
      <region xml:id="background" p5:style="backgroundStyle" p6:zIndex="0" xmlns:p6="http://www.w3.org/2006/10/ttaf1#styling" xmlns:p5="http://www.w3.org/2006/10/ttaf1" />
    </layout>
  </head>
<!--?xml version="1.0" encoding="utf-8"?-->
<tt xml:lang="es">
  
    
      
   </tt>
Jun 12, 2012 at 12:08 PM

Do the subtitles work correctly when running the captions related SMF samples (2.6 version) from inside Visual Studio? Does one need to configure MIME type for DFXP somehow for the internal web development server (is it IIS Express?) used by Visual Studio 2010? Are clientaccess policy files needed in the web test project when run locally from inside VS?

Jun 16, 2012 at 2:02 PM

Seems internal Visual Studio server (Cassini) can't be configured for MIME types, so if that's an issue with DFXP not getting served or something, one has to change project options to use IIS Express or IIS

Jun 16, 2012 at 3:08 PM

In SMF 2.7, if one runs the Samples project, then for the "Captions \ External Captions File" sample they don't see a caption overlay bar at all (the other caption samples work ok). However if they run the Samples.Web project (it also runs using the internal Visual Studio Development server), they see a web folder where they can navigate to the SamplesTestPage.html in which case they see the same samples UI as before, but not if they go to "Captions \ External Captions File" sample, it works!

So when it's run via a Web project it works (the web project is set to use internal development server, not external IIS), but when run using autogenerated Silverlight page it doesn't. Any idea why?

Jun 16, 2012 at 3:29 PM

I checked the web.config of the web project and it doesn't set MIME types (not that internal development server would respect that anyway, only IIS / IIS Express would). So most probably the reason the external DFXP file captions sample doesn't work when not run via Samples.Web but run via Samples project directly is that it can't find the .dfxp file which is located in ClientBin folder of Samples.Web project, but is not in Samples project.

Tried copying the samplecaptions.xml (note that it doesn't use .dfxp file extension so that it gets served without having to set MIME type for .dfxp to text/xml) to various locations in the Samples project, but didn't work (even tried to include it in the project and use "Content" and "Copy if newer" at the item properties in solution explorer).