This is a fully automated change. The linter will fail because the
extra indentation caused line-length errors. These won't be fixed
automatically. They are fixed in a follow-up to make this one fully
automated.
Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.
Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
This is an automated change to convert use of "function" functions
to arrow functions. This doesn't change all uses of bind() that
could be converted. This also doesn't remove all "function" functions.
Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
A coming update to the Google eslint config will require using "const"
over "let". This makes that one change to isolate the big changes.
Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
This is only some of the warnings produced. These were not errors,
but we should fix them anyway so that we can adopt stricter settings
in future.
Change-Id: Ifd12f0e7c69f8f4b3d0d78b11794da2569a06d77
This change adds support for images via SMPTE-TT by adding background image support to the TTML text parser. This required changing region parsing to respect global extends.
Issue #840
When CEA captions are extracted from video segments, the
presentationTimeOffset of the video segment should be applied to the
extracted captions, as well.
Fixes b/70902665
Change-Id: I446333a14b8b6374786ab594a579b6e18bc73ac1
Before, media source engine could be created with no text displayer.
However, player would always create media source engine with a
text displayer.
Just like with closed captions, this appeared to be a good time
to change it to be passed in the constructor and have media source
engine own it.
This now means that media source engine is responsible for destroying
it - lessening player's responsibilities.
Change-Id: I71cd1c28a3c22d3c765a3892fe74ae3f9abd1914
CSS style 'direction' supports only horizontal directions, (left to
right, right to left), and writing-mode supports horizontal top to
bottom, vertical left to right, vertical left to right.
Separating the field 'writingDirection' to two fields 'direction'
and 'writingMode', so that they're the same as the css style names.
Issue #1708
Change-Id: Ie730bd7d13e5483d7425261854c268cd7f095400
In the methods use for testing, when getting the number of
close caption cues, we were only addressing the channel by "id".
This updates the name to be "channelId" so that it is clear
what the id will map to.
Change-Id: I773d5a63c376b832d492b41cf2505d8a27ea0f32
This change refines and emphasizes the message of the test only
methods for closed captions in text engine.
Change-Id: I0f13f0fa48f3b464c8dc4166ddbd12f09f53874c
The close caption map cannot be null in text engine, but we were
still checking if it was falsy. Since it can't be null, we can remove
the falsy check.
With the falsy check removed, the expression was able to be reduce
even further.
Change-Id: I839bc2337cfa1415cc6b00b75602e608f75b0e13
Refactor the closed captions support for HLS, using the same approach as
the closed captions support for Dash.
If closed captions are signaled in the manifest, player will create a
text stream for to represent the closed captions, and text engine will
store and append them. We don't need to set 'useEmbeddedText' value for
closed captions any longer.
Issue #1404
Change-Id: I9a5bf4df7e29d6e6982f29fd5e2df07bc78071d7
Removing a few hacks from player and streaming engine, so that now
closed captions streams are treated almost the same way as usual text streams.
Fixed the issue where toggling the closed captions doesn't work.
Fixed the delay of showing closed captions when we seek to a buffered
stream.
Issue #1404
Change-Id: I28a739f3033f30b53b3adf8fa1a181e3d4592f6f
Adding support for CEA closed captions embedded in video streams for
Dash.
1. Dash parser reads and parses closed captions' channel and language
information.
2. Player creates text streams for the closed captions.
3. Media Source Engine calls mux.js Caption Parser API to get the closed
captions embedded in the video streams.
4. Text Engine stores the closed captions, and text displayer shows the
captions.
TODO:
1. Add test cases, will send out another CL.
2. Change closed captions support for hls to the similar way we handle
dash closed captions, will send out another CL.
3. Handle dash content that's missing language indication from the manifest.
Issue: #1404
Change-Id: Ibae8f69623c13561415ec860107d7f5bc86e19e9
Browser support is currently buggy and limited, so until they fix it,
this removes VTTRegion support.
Closes#1584
Change-Id: Ia5bb34dd3ea94737adcdd1d441201bb97b303f81
This replaces almost every instance of indexOf on both String and
Array. There are very few places where we really wanted an index.
Mostly, indexOf was used to check for inclusion.
Change-Id: I08e299768b6ffdb4bfc30b39b5d82a058c6d1b56
This reverts commit c38d4dd8d3, which
actually broke text range calculations in v2.3.10, and v2.4.2-v2.4.4.
The original commit was meant to account for the period start, but
resulted in a double-accounting of presentationTimeOffset.
The start and ends times passed into TextEngine's appendBuffer were
period-relative, so timestampOffset had already been applied. To
avoid further confusion and to fix the original issue the reverted
commit tried to address, these have been changed to
presentation-relative timestamps. Now the period start and all
offsets have been accounted for before the metadata reaches
MediaSourceEngine and TextEngine.
The tests added in the bad commit have been modified to test for the
opposite: that we do not erroneously account for timestamp offset when
calculating the buffered ranges for text.
Closes#1562
Change-Id: I9fa7a3f59906c4f3e623f411e48551f86f5c2ff7
Since the convert methods in SimpleTextDisplayer do not affect the
state of |this|, this changes them to be static to better represent
the in/out affect of the methods.
Change-Id: I1084fd64490f4ef9aa97972913e5e14ff6245051
Since we only need to know about which cues a text track has when we
remove cues, there is no need to keep a local copy.
Since some platforms return null if the track is disabled, we do need
to temporarily change the mode if the track is disabled so that we can
get the cues.
However, this limits the scope of these "special" conditions to a single
function.
Change-Id: I7026e9c73629ef86633d5fe732f21a48178e8767
On some platforms, the cue list object returned by TextTrack
might not update as cues are added and removed.
To account for that, this changes simple_text_displayer to fetch
a new cue list when one is available.
Change-Id: I9eda19197b343b0f6385a8cbb64cef8f2b31b9b9
https://goo.gl is being turned-down, so we can't use it for new URLS.
So we have consistent short links, this converts them to be
https://bit.ly.
Change-Id: I07a86cba807b67157664893341f648023918d0de
For multi-Period content, we need to account for the timestamp offset
in the buffered range calculation since the start/end times are
given as Period-relative.
Change-Id: I6d32de2abc316918333b1c58ba73c71d028284c4
Previously, we would read each individual VTTC and VTTE box in the
MDAT and associate them with durations in the TRUN. This worked for a
lot of content, but if sampleSize is defined in the TRUN, a duration
might refer to multiple VTTC boxes.
This changes the VTT in mp4 reader to parse the MDAT based on the TRUN,
to account for such situations.
For the moment, this only accounts for a single MDAT, and assumes that
the MDAT contains nothing but vttc or vtte boxes, listed in order.
Issue #1266
Change-Id: I56e310d085abdda16e968761ed3b4fd0cc5e24d0
This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.
This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.
Change-Id: I2bfa4d531a8fcdcf9578e9c181c4534ad7443b7a
Google style guide requires adding curly braces to all block statements
even if it is only has one line. This fixes it by using eslint's
--fix flag followed by running clang-format to reformat the change.
Change-Id: Idc086c2aa8c02df5ef8b2140a11bfb9128eeb4bd
This is part of a change to convert all usages of 'var' with either
'let' or 'const'. This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.
Change-Id: I6a329d28e13a81c9f7136737518c6bb8fa18402e
During docs review, I noticed that shaka.text.TtmlTextParser's
textAlignToLineAlign_ was defined as merely {Object}. Improving that
to {Object.<string, string>} caused compiler issues, so I had to
further refine to {Object.<string, shaka.text.Cue.lineAlign>} and
refer to the enum values instead of directly using strings.
Issue #1259
Change-Id: Ifb012771a534f74f4458f8673fd4d12d136b2638
We incorrectly added the presentationTimeOffset to the segment times as
a fix for #1164. The correct fix is to use the include the PTO in the
time structure passed to the text parsers. This is a partial revert
of 207505.
Issue #1164Closes#1232
Change-Id: I1f2805e0dbdc44be71e2160b3d37a73732c97a4f
This updates jsdoc to the latest version from npm and forks a copy of
the default jsdoc template.
In subsequent commits, we will reapply our customizations to the
template and to a jsdoc plugin.
This also fixes several bad annotations that the new jsdoc failed to
parse.
Issue #1259
Change-Id: I00a47270ea4754e1c96c43ca900d5cf889ab72e6
When the MPEGTS field rolls over in HLS live WebVTT, we need to avoid
our parsed cue timestamps rolling over as well. To achieve this, we
simply ignore the X-TIMESTAMP-MAP tag once the segment index is built.
Rollover in TS video and audio segments is handled by mux.js already.
Closes#1191
Change-Id: Ie52734509921973ff47517fab34367ec413a6ca6
The eslint configuration is derived from analyzing the style of our
sources as they are now, plus a few tweaks.
In particular, we have disabled checks for undefined variables and use
of console, both of which the compiler handle with greater precision.
The compiler already knows what is defined in the environment through
our externs, and has specific exceptions for the use of console (demo,
tests).
We have also disabled a few checks that we should use, but will
require many changes to the code: no-unused-vars, no-redeclare,
and comma-dangle.
This commit also fixes several types of eslint errors that were easy:
- no-useless-escape (unneccessary escape characters in Regexp)
- no-constant-condition (using true/false/0/1/etc in if/while)
- no-fallthrough (caught an actual bug in one EME polyfill)
- no-irregular-whitespace (we had a UTF-8 nbsp in externs)
- no-cond-assign (using an assignment inside a conditional)
To satisfy stricter provide/require checks in the Closure Compiler
Linter, we will no longer use provide/require at all in tests. We
will still use provide in test utilities (test/test/util/) since it
sets up the namespace for us. But we will not use require there
because there is no deps management for test code.
Issue #1157
Change-Id: Icc44f51feeb568ea7d3980e693e92e560d897afd
These were not caught by the compiler due to aliases used to access
them, but they were caught by some new linter tools I am trying to
integrate into the build.
Change-Id: I343d155d43285e8244376b95c95b08b5d4f2fa39
Instead of taking Uint8Array for media segments and ArrayBuffer for
init segments, take Uint8Array for everything.
Clean-up after #1022, discovered while preparing the upgrade guide for
v2.3.
Change-Id: I1f284f6f51f345e663c06d96d788bd9cfb941c52
Our use of VTTRegion seems to be wrong. The feature in Chrome is
behind the "experimental web platform features" flag. If this is
turned on, we display subtitles in the wrong place.
Until we can verify and fix our usage of VTTRegion, we will not
use it. There are other issues to deal with in our region support,
in particular that TTML uses px and VTT uses percentages. Futher,
our VTT parser does not yet extract region information.
This fixes the main issue for v2.3, so that future releases of Chrome
do not break sites built with v2.3. There is more work to do in v2.4.
Issue #1188
Change-Id: I0de3392bdfca381c3727580e66c1a57ec457c5c2