google-castchromecastttml

ChromeCast Parse Segmented TTML


Hy!

I have an ism file with Smooth Streaming and PlayReady. This ism contains the caption in segmented ttml format.

But this ttml has a new line character for example: p8:br How can I parse it and replace theese characters to /n (or whatever that Google ChromeCast can handle)?

So than I can see the subtitle in 2 lines instead of one.

I know I can get the streaminfo with protocol.getStreamInfo(index), but what can I do after it?

UPDATE #1

We do an application for other platforms and the method there was the following. The ttml variable contains the caption of the movie.

  ttml = ttml.Replace("<p7:br />", "\n");
  ttml = ttml.Replace("<p8:br />", "\n");
  ttml = ttml.Replace("<p7:br/>", "\n");
  ttml = ttml.Replace("<p8:br/>", "\n");
  ttml = ttml.Replace("<br />", "\n");
  ttml = ttml.Replace("<br/>", "\n");

After the new line characters replaced to "\n", the application started to show the current text depends on the time (there was eg. a label at the bottom of the movie.)

UPDATE #2

Here is a sample from the dfxp:

   <p p7:region="speaker" p7:begin="00:04:31:21" p7:end="00:04:37:22"  xmlns:p7="http://www.w3.org/2006/10/ttaf1">Talán mert nem vagy olyan okos?<p7:br />Mert lassú a felfogásod?</p>
   <p p7:region="speaker" p7:begin="00:04:38:23" p7:end="00:04:42:11" xmlns:p7="http://www.w3.org/2006/10/ttaf1">Eressz, különben<p7:br />nem állok jót magamért.</p>  
   <p p7:region="speaker" p7:begin="00:04:52:17" p7:end="00:04:55:10" xmlns:p7="http://www.w3.org/2006/10/ttaf1">Mesélj a nagypapáról.</p>
   <p p7:region="speaker" p7:begin="00:05:08:18" p7:end="00:05:14:12"   xmlns:p7="http://www.w3.org/2006/10/ttaf1">A cukornádföldön voltam.<p7:br />Akkor kapott el, mikor egyedül voltam.</p>

At the last line ot the sample, the device couldn't recognized the characters and show the subtitle the following way:

A cukornádföldön voltam.Akkor kapott el, mikor egyedül voltam.

Instead of

A cukornádföldön voltam.

Akkor kapott el, mikor egyedül voltam.

So I would like to do some similar operations with the help of ChromeCast API. But that would be easier to just simply change the characters, because the ChromeCast can handle the timing perfectly.

Thank you very much!


Solution

  • There is a bug that will be fixed in the Media Player library soon; that should address this namespace issue. I will update this post when a fix is released.