[WEBVTT] Fix missing text alignment tags from output
Legacy players, e.g. older versions of ExoPlayer, do not handle default webvtt text alignment correctly. Need to specify `align:center` explicitly cues without text alignment for backwards compatibility. Fixes #925.
This commit is contained in:
parent
37b16b4091
commit
d9124d6aaa
|
@ -3,9 +3,9 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:00.000 --> 00:00:00.800
|
||||
00:00:00.000 --> 00:00:00.800 align:center
|
||||
Yup, that's a bear, eh.
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</AdaptationSet>
|
||||
<AdaptationSet id="2" contentType="text" subsegmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="caption"/>
|
||||
<Representation id="2" bandwidth="273" mimeType="text/vtt">
|
||||
<Representation id="2" bandwidth="317" mimeType="text/vtt">
|
||||
<BaseURL>bear-english-text.vtt</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
|
|
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:00.000 --> 00:00:00.800
|
||||
00:00:00.000 --> 00:00:00.800 align:center
|
||||
Yup, that's a bear, eh.
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:00.000 --> 00:00:00.800
|
||||
00:00:00.000 --> 00:00:00.800 align:center
|
||||
Yup, that's a bear, eh.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</AdaptationSet>
|
||||
<AdaptationSet id="2" contentType="text" segmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
|
||||
<Representation id="2" bandwidth="2056" codecs="wvtt" mimeType="application/mp4">
|
||||
<Representation id="2" bandwidth="2216" codecs="wvtt" mimeType="application/mp4">
|
||||
<SegmentTemplate timescale="1000" initialization="bear-english-text-init.mp4" media="bear-english-text-$Number$.m4s" startNumber="1">
|
||||
<SegmentTimeline>
|
||||
<S t="0" d="1000" r="4"/>
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:00.000 --> 00:00:00.800
|
||||
00:00:00.000 --> 00:00:00.800 align:center
|
||||
Yup, that's a bear, eh.
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
<Period id="0" start="PT0S">
|
||||
<AdaptationSet id="0" contentType="text" segmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
|
||||
<Representation id="0" bandwidth="2056" codecs="wvtt" mimeType="application/mp4">
|
||||
<Representation id="0" bandwidth="2216" codecs="wvtt" mimeType="application/mp4">
|
||||
<SegmentTemplate timescale="1000" initialization="bear-english-text-init.mp4" media="bear-english-text-$Number$.m4s" startNumber="1">
|
||||
<SegmentTimeline>
|
||||
<S t="0" d="1000" r="4"/>
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:00.000 --> 00:00:00.800
|
||||
00:00:00.000 --> 00:00:00.800 align:center
|
||||
Yup, that's a bear, eh.
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<Period id="0" start="PT0S">
|
||||
<AdaptationSet id="0" contentType="text" segmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
|
||||
<Representation id="0" bandwidth="1216" mimeType="text/vtt">
|
||||
<Representation id="0" bandwidth="1320" mimeType="text/vtt">
|
||||
<SegmentTemplate timescale="1000" media="bear-english-text-$Number$.vtt" startNumber="1">
|
||||
<SegmentTimeline>
|
||||
<S t="0" d="1000" r="4"/>
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:00.000 --> 00:00:00.800
|
||||
00:00:00.000 --> 00:00:00.800 align:center
|
||||
Yup, that's a bear, eh.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,6 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<Period id="0" start="PT0S">
|
||||
<AdaptationSet id="0" contentType="text" lang="pt" segmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
|
||||
<Representation id="0" bandwidth="2056" codecs="wvtt" mimeType="application/mp4">
|
||||
<Representation id="0" bandwidth="2216" codecs="wvtt" mimeType="application/mp4">
|
||||
<SegmentTemplate timescale="1000" initialization="bear-english-text-init.mp4" media="bear-english-text-$Number$.m4s" startNumber="1">
|
||||
<SegmentTimeline>
|
||||
<S t="0" d="1000" r="4"/>
|
||||
|
|
|
@ -4,9 +4,9 @@ X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:9000
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:00.000 --> 00:00:00.800
|
||||
00:00:00.000 --> 00:00:00.800 align:center
|
||||
Yup, that's a bear, eh.
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<Period id="0">
|
||||
<AdaptationSet id="0" contentType="text" subsegmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
|
||||
<Representation id="0" bandwidth="353" mimeType="text/vtt">
|
||||
<Representation id="0" bandwidth="397" mimeType="text/vtt">
|
||||
<BaseURL>bear-english-text.vtt</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
|
|
|
@ -3,9 +3,9 @@ WEBVTT
|
|||
STYLE
|
||||
::cue { color:lime }
|
||||
|
||||
00:00:00.000 --> 00:00:00.800
|
||||
00:00:00.000 --> 00:00:00.800 align:center
|
||||
Yup, that's a bear, eh.
|
||||
|
||||
00:00:01.000 --> 00:00:04.700
|
||||
00:00:01.000 --> 00:00:04.700 align:center
|
||||
He 's... um... doing bear-like stuff.
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</AdaptationSet>
|
||||
<AdaptationSet id="2" contentType="text" subsegmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
|
||||
<Representation id="2" bandwidth="273" mimeType="text/vtt">
|
||||
<Representation id="2" bandwidth="317" mimeType="text/vtt">
|
||||
<BaseURL>bear-english-text.vtt</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -24,7 +24,7 @@
|
|||
</AdaptationSet>
|
||||
<AdaptationSet id="2" contentType="text" segmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
|
||||
<Representation id="2" bandwidth="1944" codecs="wvtt" mimeType="application/mp4">
|
||||
<Representation id="2" bandwidth="2104" codecs="wvtt" mimeType="application/mp4">
|
||||
<SegmentTemplate timescale="1000" initialization="bear-english-text-init.mp4" media="bear-english-text-$Number$.m4s" startNumber="1">
|
||||
<SegmentTimeline>
|
||||
<S t="0" d="1000" r="1"/>
|
||||
|
@ -56,7 +56,7 @@
|
|||
</AdaptationSet>
|
||||
<AdaptationSet id="2" contentType="text" segmentAlignment="true">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
|
||||
<Representation id="2" bandwidth="2056" codecs="wvtt" mimeType="application/mp4">
|
||||
<Representation id="2" bandwidth="2216" codecs="wvtt" mimeType="application/mp4">
|
||||
<SegmentTemplate timescale="1000" presentationTimeOffset="2001" initialization="bear-english-text-init.mp4" media="bear-english-text-$Number$.m4s" startNumber="4">
|
||||
<SegmentTimeline>
|
||||
<S t="2001" d="1000" r="2"/>
|
||||
|
|
|
@ -83,7 +83,7 @@ TEST_F(WebVttMuxerTest, WithOneSegmentAndWithOneSample) {
|
|||
const char* kExpectedOutput =
|
||||
"WEBVTT\n"
|
||||
"\n"
|
||||
"00:00:05.000 --> 00:00:06.000\n"
|
||||
"00:00:05.000 --> 00:00:06.000 align:center\n"
|
||||
"payload\n"
|
||||
"\n";
|
||||
|
||||
|
@ -122,14 +122,14 @@ TEST_F(WebVttMuxerTest, WithTwoSegmentAndWithOneSample) {
|
|||
const char* kExpectedOutput1 =
|
||||
"WEBVTT\n"
|
||||
"\n"
|
||||
"00:00:05.000 --> 00:00:06.000\n"
|
||||
"00:00:05.000 --> 00:00:06.000 align:center\n"
|
||||
"payload 1\n"
|
||||
"\n";
|
||||
|
||||
const char* kExpectedOutput2 =
|
||||
"WEBVTT\n"
|
||||
"\n"
|
||||
"00:00:15.000 --> 00:00:16.000\n"
|
||||
"00:00:15.000 --> 00:00:16.000 align:center\n"
|
||||
"payload 2\n"
|
||||
"\n";
|
||||
|
||||
|
@ -189,7 +189,7 @@ TEST_F(WebVttMuxerTest, WithAnEmptySegment) {
|
|||
const char* kExpectedOutput2 =
|
||||
"WEBVTT\n"
|
||||
"\n"
|
||||
"00:00:15.000 --> 00:00:16.000\n"
|
||||
"00:00:15.000 --> 00:00:16.000 align:center\n"
|
||||
"payload 2\n"
|
||||
"\n";
|
||||
|
||||
|
|
|
@ -249,6 +249,7 @@ std::string WebVttSettingsToString(const TextSettings& settings) {
|
|||
ret += " align:right";
|
||||
break;
|
||||
case TextAlignment::kCenter:
|
||||
ret += " align:center";
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -163,9 +163,10 @@ TEST(WebVttUtilsTest, SettingsToString) {
|
|||
TEST(WebVttUtilsTest, SettingsToString_IgnoresDefaults) {
|
||||
TextSettings settings;
|
||||
settings.region = "foo";
|
||||
settings.text_alignment = TextAlignment::kCenter;
|
||||
|
||||
const auto actual = WebVttSettingsToString(settings);
|
||||
EXPECT_EQ(actual, "region:foo");
|
||||
EXPECT_EQ(actual, "region:foo align:center");
|
||||
}
|
||||
|
||||
TEST(WebVttUtilsTest, FragmentToString) {
|
||||
|
|
Loading…
Reference in New Issue