ChromeCast Parse分段TTML(ChromeCast Parse Segmented TTML)

编程入门 行业动态 更新时间:2024-10-18 05:58:23
ChromeCast Parse分段TTML(ChromeCast Parse Segmented TTML)

海兰!

我有一个带有Smooth Streaming和PlayReady的ism文件。 这个ism包含分段ttml格式的标题。

但是这个ttml有一个新的行字符,例如:p8:br如何解析它并将theese字符替换为/ n(或Google ChromeCast可以处理的任何内容)?

所以我可以看到2行而不是1行的副标题。

我知道我可以使用protocol.getStreamInfo(index)获取streaminfo,但是我可以在它之后做什么?

更新#1

我们为其他平台做了一个应用程序,方法如下。 ttml变量包含电影的标题。

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");

在将新行字符替换为“\ n”后,应用程序开始显示当前文本取决于时间(例如,电影底部有一个标签。)

更新#2

以下是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>

在样本的最后一行,设备无法识别字符并以下列方式显示字幕:

一个cukornádföldönvoltam.Akkorkapott el,mikorgyedülvoltam。

代替

一个cukornádföldönvoltam。

Akkor kapott el,mikoregyedülvoltam。

所以我想在ChromeCast API的帮助下做一些类似的操作。 但是,仅仅更改角色会更容易,因为ChromeCast可以完美地处理时间。

非常感谢你!

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!

最满意答案

很快就会在Media Player库中修复一个错误; 应解决此命名空间问题。 我将在发布修复程序时更新此帖子。

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.

更多推荐

本文发布于:2023-08-05 21:35:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1437983.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Parse   ChromeCast   Segmented   TTML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!