LL-HLS hints a resource that is needed to playback in the upcoming
update. It's available for request, and may not be available for
download yet.
A preload hinted resource is either a partial segment, or an init
segment. If it's an init segment, treat it the same way as the Map tag
in ManifestTextParser.
A preload hinted segment contains no duration information, so its
start time and end time are the same. It will be replaced by a partial
segment in the next update.
We should fetch and append the preload hinted segment the same way as a
partial segment.
Issue #1525
Change-Id: I1e30f216ecdc843c3cd01681629a8886383d0b22
Changed SegmentIndex and SegmentIterator to iterate through regular and
Partial SegmentReferences.
SegmentIndex:
merge(): Find all the old segments after the first new segment's start
time, and replace the old ones with new segments.
SegmentIterator:
Use the currentPosition and currentPartialPosition pointers to iterate
through the two-layer arrays.
current(): Get the current SegmentReference, and get its current Partial
SegmentReference if it has a Partial Segment list. Move to the next
regular segment if we reached the end of the current segment's partial
list.
next():
If the regular segment has a partial list, go to the next Partial
Segment. If reached the end of the current partial list, move to the
next regular segment.
If the regular segment doesn't have a partial list, move to the next
regular segment.
Issue #1525
Change-Id: Icb7f49e50314f15ea40bf3a74d008191ed1a9a6c
Player can request delta updates to reduce the transfer cost.
Client: sends a request for playlist update with '_HLS_skip=YES'
parameter.
Server: replaces the older segments in the media playlist with
'EXT-X-SKIP' tag.
Issue #1525
Change-Id: I3643641d0cb97444ba1c00f06d9e113acba7b824
For LL-HLS, use the value of 'PART-HOLD-BACK' in the Server Control tag
as the default presentation delay.
'PART-HOLD-BACK' is the server suggested min distance from the live
edge, and must be >= 3 * partial segment target duration.
It's always available when the playlist contains partial segments.
Issue #1525
Change-Id: I176188dbd39be0d038eee938d3e8358e54b8a3a8
Low Latency HLS uses 'EXT-X-PART' tag for Partial Segments.
ManifestTextParser will parse the Partial Segment tags, and add them to
the regular segment after them.
If a list of Partial Segment tags is being published and doesn't have a
regular segment Uri following it yet, create a segment object to wrap
the Partial Segment tags list.
Issue #1525
Change-Id: Ie04ed70ae15c88416d677d67b721f76bc2f5b486
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.
It seems that the `!` in the header forces the compiler to keep it in
the output. I believe older compiler releases did this purely based
on `@license`.
Issue #2638
Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
One playlist may contain multiple EXT-X-MAP tags, and each EXT-X-MAP tag
represents the initalization information for the segments after it,
until the next EXT-X-MAP tag or the end of the playlist.
Issue #1335Closes#2397
Change-Id: Ibb0b4f5da6a48f0303d205cb6bd3abad278527fd
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.
This also updates the company name from "Google, Inc" to "Google LLC".
Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
These are intermittently used and cannot be verified. Most of our
methods can throw a shaka.util.Error, so having it doesn't really add
anything. Plus, if we change a function to throw, we'd need to update
all their callers to ensure they have an accurate description of what
they throw; otherwise we can't trust the directive.
Change-Id: I520bd0fc4c33443e967bf5b103ca5aa9e3274884
This changes the network API to use BufferSource instead of ArrayBuffer,
which allows plugins to return a "view" on a buffer instead of the
whole buffer. This also adds some utilities for changing between
views and buffers.
Lastly this forbids the use of the "buffer" property of TypedArrays
since it doesn't work with partial "views". This audits and fixes the
usages of the "buffer" property to ensure correct usage.
It should be noted that both MSE and EME accept a BufferSource as input,
so we don't need to convert a "view" into an ArrayBuffer before passing
to it.
Change-Id: Iaa417773f8ce5304424e43c7372ce10ebf540d2a
This is a helper to aid in iterating over items. This returns a list
of objects that contain:
- "item": The current value.
- "prev": The previous value in the list.
- "next": The next value in the list.
- "i": The zero-based index in the list.
Issue #1518
Change-Id: Id18ab977e3ae45dfbfd2b4137a1bffb6e53c6bce
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
This enables the eslint rule that requires all functions to consistently
either return a value or not return a value.
Change-Id: I98b579f3689c3b6c74968116824231bb792bd9dd
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 fixes issues with the interpretation of URIs in HLS and makes
their usage and meaning consistent and clear.
- Name URI variables as either absolute, final (post-redirect), or
verbatim (exactly as they appear in the playlist)
- Identify media playlists by their verbatim URI when testing for
equality or duplication
- When a master playlist is redirected, interpret media playlists as
relative to the redirected location
- When a media playlist is redirected, request updates from the
redirected location
- When updating a media playlist, resolve media segment URIs as
relative to the latest redirected media playlist URI
- Resolve absolute segment URIs when parsing the playlist text,
rather than waiting until we intepret and build the manifest
- Remove some incidental bind() calls, which exposed compiler errors
- Avoid refactoring long parameter lists
- Avoid refactoring for async/await
- Clean up redirection tests, which were brittle and did not verify
what they seemed to
- Use relative segment URIs for all segments in tests
- Use media playlist URIs within master playlists in tests
- Add a regression test specifically for #1664Closes#1664
Change-Id: I45f946790c7d669637c231ae93920a09c18c4222
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
Normally, we expect that only media playlists contain segment tags
(EXT-X-KEY, EXTINF, etc). We determine if a playlist is a media
playlist by the presence of an appropriate playlist tag (EXT-X-MAP,
EXT-X-PLAYLIST-TYPE, etc).
However, we were checking tags one-by-one, on a single while loop.
This meant that we would reject manifests where a segment tag appears
before a playlist tag, as we did not yet know that the playlist was a
media playlist.
This changes the manifest text parser so that it checks for playlist
type first.
Issue #1382
Change-Id: I1b9f674a58c60ab291d6d004462b0c0cae49631d
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: I5904ec91b96417a9ac5e19cb4f7b07a084f26ac8
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: I45fb053b6a92f36313cfbc060eeec36cdccc581b
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: Ib395106b14156a1f4000b516131684e319db78de
This digests and organizes many of the automatic settings in eslint,
and changes several of them to be more strict. This also fixes the
following errors:
- array-callback-return
- no-catch-shadow
- no-multi-spaces
- no-new
- no-throw-literal
- no-useless-call
- no-useless-concat
- no-useless-return
Several checks have been organized into a group of checks we should
use, but need more time to implement and fix. Some other checks have
been delegated to the Closure compiler, which can more precisely
whitelist exceptions.
Issue #1157
Change-Id: I8fe4966959e08050f8159e6a1fee161e7d71177e
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
Media Playlist tags can appear not only before all the segments
info, but inside and after it as well. We used to assume that after
the first segment tag appears, the rest of the tags can only be
applicable to segments.
Now parser will check what kind of tag it parsed and treat it
appropriately.
Change-Id: I6b6f88c272a54f682829397c97f41bac971bce5f
This is part of adding a new conformance rule to add additional type
safety. This will disallow using properties of unknown types or using
unknown properties.
The first parts will be fixing errors caused by the new rule. These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.
Change-Id: Iefde089b2f62ddfdf43944cda5badab438577561
This adds a severity field to Error objects. This can be used to
detect whether an error is recoverable. All the same errors are still
reported so the field can be ignored.
There are two possible values:
* RECOVERABLE means that the Player will try to recover from the error
* CRITICAL means the Player will be unable to continue and must call
load() again
Closes#564
Change-Id: Ie2c5468340c13e7a288b99690ab65b7ecc0a6b29
This abstracts the creation of DrmInfo to parse the EXT-X-KEY tag
differently per KEYFORMAT.
Issue #279
Change-Id: I2e187dcfc01f7306183c9090c54de58e81872bc4
This change enables HLS parser to get DRM information
from the manifest and create DrmInfo objects.
Note that until we actually add support for any of the
drm systems, we will still reject encrypted content.
Issue #279.
Change-Id: I4d0652411a567bc75d919c5bf732f20e870a5aeb
Until we implement support for protected content for HLS, we
reject it. We used to determine it by the presence of an
'EXT-X-KEY' tag. However, it is possible for the manifest to
have the tag, but describe clear key content if the 'METHOD'
attribute of the tag is 'NONE'. This CL insures we don't reject
this kind of playlists.
Issue #279.
Change-Id: Iee853dd23116c40a43b228f0876efe373c3111af
For HLS Drm Init Data, the whole tag needs to be passed down to
the cdm. This is a problem as by the time the drm init data is
being created the tag has been parsed and no longer has reference
to its original form.
This change adds a function "toString" to create a tag that would
be the same as its original text form.
As we create tags in our tests - it was not feasible to just give
it a text tag value so instead the function will recreate the text
form.
Change-Id: Idbc5bff3dd088a3aa3a67ef6a22749ea91bb1ccf
HLS parsing will be split into parsing the text of the manifest into
shaka internal objects and parsing those into a shakaExtern.Manifest.
This will make logic more clear and allow to test ManifestTextParser
independently of HlsParser.
Issue #279.
Change-Id: I44349966d3617e2d208185e3ad125ecea89732b4