According to the style guide, protected members should not end with
an underscore. This renames them to fix it. This also marks some
members as private that aren't used outside the class. Lastly, this
fixes a possible bug with the use of "this".
Issue #1553
Change-Id: I6c7ecdcd228ec4e4aded4af52e2262d0bf5beaf4
This reverts commit 6e5a0797de, #2042.
The PR as it landed broke some test cases and functionality for storing persistent licenses, and it doesn't seem to work even for its intended use case.
To prepare for flattening out the manifest structure to remove
periods, this change moves initSegmentReference and
presentationTimeOffset fields into the SegmentReference object. This
way, the segments on either side of a period transition or HLS
discontinuity can have different offsets or init segments, eventually
allowing us to create a single array of SegmentReferences for
multi-period content.
Issue #1339
Change-Id: Ic7eff0483789644881247ecf8044c5fb6a48f0e6
* fix: Reference issue with SegmentReference createUris
* test: Added Segment GetUris Test for timeline
* feat: Get PSSH from segements if not initdata exists
* feat: Get PSSH from segements if not initdata exists
* fix: JSDoc comments and moved drmEngine update to storage
* fix: Remove comments
* fix: Remove unused import
* fix: Lint erros and dedup initData code
* fix: remove no init data test and add check for use persistent license
To prepare for an upcoming change to the format of the data stored in
IndexedDB, refactor the storage cells to remove common functionality.
This will make it easier to add a third cell type.
The format will change as we move fields in the manifest structure and
ultimately flatten out periods.
Issue #1339
Change-Id: Ibaeb35596180b2e2362b4d53734019599d6fff77
This replaces find/get callbacks in Stream with a SegmentIndex. With
the exception of DASH's SegmentTemplate+duration, all manifests were
already backed by SegmentIndex. Now, all manifests are backed by
SegmentIndex. This will simplify Period-flattening, in which all
tracks will be represented by a list of segments, some of which come
from different Periods.
The SegmentIndex in Stream will not be created until
createSegmentIndex is called. Prior to this change, the find/get
callbacks could be invoked without createSegmentIndex() in some cases
(excluding DASH's SegmentBase), which some lazy tests took advantage
of. Now that find/get are methods on SegmentIndex, createSegmentIndex
must be called in all cases. The tests have been updated accordingly.
Making SegmentIndex generation async in all cases exposed some issues
with the parser context being modified in-place between one
Representation and the next. So the parser now makes a shallow copy
of the context before it is bound into an async callback.
To facilitate updating the SegmentIndex for SegmentTemplate+duration
content, SegmentIndex now has a method to update its list on a timer.
Once per segment duration, the index will be updated to add and remove
SegmentReferences.
The initial expansion of SegmentTemplate+duration will be limited to a
relatively small number of segments, to avoid excessive CPU or memory
consumption. This defaults to 1000 segments, but is configurable.
Issue #1339
Change-Id: I99c007b1096c3b396d04a729750cd7b743cb899d
This changes several classes to use the Destroyer class to handle
destroy(). This also changes the behavior to not ignore destruction
and instead throw a new error. This is more clear for callers and
ensures we propagate errors.
Change-Id: I756c085639558509c22e5c43d69ddf4acd28d46f
This makes progress callbacks into a required parameter on all network
scheme plugins. This does not mean that every plugin must make use of
the callback, but every caller must supply the callback.
In production, NetworkingEngine already supplies this callback
universally, so our HTTP plugins make use of it whenever progress data
is available.
Our tests, however, did not always supply this callback, leading to
test failures. These failures were more likely to show up in Jasmine
3 than Jasmine 2 for some reason, which caused us to downgrade back to
Jasmine 2 recently.
By making the callback required, we can clean up this inconsistency
between test and production and give the HTTP plugins what they expect
in all cases.
Issue #1949
Change-Id: I8a6e1904e73cf7ca6ae8f3964261c339f404854d
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 enables the eslint rule that requires all functions to consistently
either return a value or not return a value.
Change-Id: I98b579f3689c3b6c74968116824231bb792bd9dd
With this change, offline and UI config can use the same two-argument
short form that the Player config interface offers.
Change-Id: I5f40ef58da76f3aab1d7178fe7d6e82097352b9a
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
- Disallow mixing different types of some operators (e.g. && ||).
- Disallow useless constructors.
- Require a newline between class members.
- Require spacing around arrow functions.
- Require using the compound assignment when possible (e.g. +=).
- Check for possible errors in assignments involving "await".
Change-Id: Ib48167aea61a62b33f0b76bb869abe18398ee5b7
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
At the moment, the storage manager does not support multiple concurrent
downloads. This modifies the demo to create a new storage instance every
time a storage operation is desired, then dispose of that instance after
the operation is complete.
This also refactors out the shaka-main-offline-changed event, which was
no longer necessary after allowing asset cards to re-load their buttons.
Issue #1432
Change-Id: I1312cf74a92f877279adb461e423a38e93bcfa0f
It is type-safe to alias a class, but not one of its static methods.
Aliasing the method without the class makes it a "free call" to invoke
the aliased method.
A "free call" is when you call a method without the context of its
instance of class. There were several cases of this with static
methods.
This will be enforced by a future release of the compiler, which I
believe will lead into compiler support for "this" in static ES6
methods. In ES6, you can use "this" in static methods to refer to the
class and call other static methods. Closure compiler doesn't support
static "this" yet, but we will start using it as soon as it is
supported.
Change-Id: I4249db8b6dda9231ebba60ee0d4ad734a692c2fe
We support these older ones and warn about the deprecation, so do not
also leave the older configs and trigger an error from configure.
Change-Id: I49e25e43ce556ff54ad3c1f1408699ff36c31833
Isolate the download estimation code out of DownloadManager so that it
can be tested in isolation and allow the code in DownloadManager to
focus on downloading.
Change-Id: I509adeaf50acb77bfaa9b2128f730de2653eda81
In four different places in our code base, we did the same
work to create a segment request. The bulk of the work was
based on setting-up the range header.
This CL creates a common utility that will create the request
for us while keeping networking engine as ignorant to segments
as it was before.
Issue #1788
Change-Id: Ie3dc2a99a34b3925fecbfdaae7b1e178a0b7a3b6
Replace the last use of |Destroyer.with| in the library. The final use
was in Storage, and this CL replaces that last usage with try-finally.
Close#1516
Change-Id: Ic0946a564b66a48b567ffd6d1cfd4b9ec76fc039
The |Destroyable.with| function was a way to ensure that objects were
destroyed regardless of success or failure. With ES6 we have the
try-finally to offer this functionality.
This replaces all uses of |Destroyable.with| with try-finally with
exception of |shaka.offline.Storage|. |Storage| appears to have testing
errors if we change over to try-finally.
Issue #1516
Change-Id: Ia772b94aed047a1dd7b406fd2d716bcb64a0ca10
There was a TODO in OfflineScheme to make |getSegment| abortable. This
updates the method to use abortable operation, allowing it to be
aborted.
Change-Id: Iaa8a29c0c71ac5ed5044f448bf89057b70e89548
To make it easier to work with destroyable objects, we defined
|Destroyable.with|, but it looks like using try-finally may be easier.
This CL replaces the use of |Destroyer.with| in |Storage.remove_| with
try-finally.
Issue #1516
Change-Id: I75563335f5a5865f93bc1eb21346300c36e0a13e
To make it easier to work with destroyable objects, we defined
|Destroyable.with|, but it looks like using try-finally may be easier.
This CL replaces the use of |Destroyer.with| in |Storage.list| with
try-finally.
Issue #1516
Change-Id: I29dcda7e8990402f0edb5885eed1c546ab28400e
Refactored |StreamUtils.getAllVariants| to get variants from a collection
of periods (rather than a manifest). This allows us to avoid needing to
assert that the manifest exists (when we know it will).
Looking long-term, as part of the refactor the method was moved to a
period-focused utility class. The goal of this is to make it easier to
see what methods may go away when we flatten periods.
Change-Id: I50aa97583892361ee4714a7beaf61e4cd95fb6b4
Rather than have the manifest parser class return the factory
that we then need to call "new" on, we can just have the manifest
parser class return the parser.
This makes the call-sites in Player and Storage simpler and moves
the use of factory+new to one spot so that it will be easier to
remove in 2.6.
Change-Id: I2abb8da603c9226c230bb761a20eb8dd20fc8455
Download manager would previously queue all the requests and
then start them after |download| was called.
By making download manager start downloading each group once
the group is created, it allowed for the internals of download
manager to be simplified.
With this simplification, it is far easier to understand how the
destroy flow works.
Change-Id: Ie2d7776eae4224e2ff1c607353c22750daa4c14f
In storage, we have a |GetStreams| method to get all the streams
from a manifest. However, we do this logic twice in the class, so
this CL changes both call sites to use the same utility method.
Change-Id: Ie0f7a5db0d6302cdc011c7ef6809ef8f5d79c2ca
There were some spelling mistakes, grammar mistakes, and
unclear comments in DownloadManager. This CL goes through
the comments and attempts to better the comments.
Change-Id: I5d41f419009fc30e6fed1a61022ab27bc1728557
As part of our movement toward ES6 syntax, this CL takes the DownloadManager
class and converts it to ES6 syntax.
Issue #1157
Change-Id: Iac6f79f0f9f060d96222429a436274e127706196
A little while ago we added the methods getSelectableVariants and
getSelectableText to create a way to get the variants and text that
could be selected. They are used with |selectAudioLanguage| and
|selectTextLanguage|.
Since we were using them for selecting variants and text, it would be
a good idea to use them when creating variant and text tracks.
A natural fallout of this change, was that the |getVariantTracks| and
|getTextTracks| methods in |StreamUtils| started to look less-and-less
important. Part of this was due to |ActiveStreamMap| storing actual
streams and not ids. So in this change, you will see that the utils have
gone away. This did require a change in |Storage| but splitting this work
across multiple CLs felt unnecessary.
Change-Id: I2d9b5b0d7b70a6b2c2e7fa51d111030cb43aa68c
It looks like the lack of a constructor is at the root of the compiler
warnings when you try to alias a class.
To stop the error, I have made a small modification to the session
deleter class so that it could have a constructor.
Change-Id: Iad4614d80dc317b20f01930019096fb388b74ed9
This integrates the deprecation tool with our library and updates
all the deprecated warnings to use our new tool.
As some features needed to be removed in 2.5, this change removes them
since their deprecation checks would make us fail.
Change-Id: I28310bbe9df6839719f4763a96026d5968bdcea6
In cases of corruption or version mismatch, we must be able to delete
the database without loading anything from it. This comes up in
testing when you run an older version of Shaka Player after a newer
one has created the database.
Our ability to erase the database in these cases was lost when we
fixed#1277. This reverts that change and changes the contract of the
storage classes to ensure that we will always be able to erase the
database, no matter what.
Change-Id: Iccfbe1fa2ca880877e4743e5ca6bd42cba44abe0
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
We were failing to download text. It appears we were not creating
the segment references for the text streams. This adds the text
streams to the set of streams that we are looking to download.
BUG: b/118437010
Change-Id: Ie4367e61519b5856cb63cacf8621453b677cf94b
(cherry picked from commit ec837b91193c07e8ba15300fb56f5b4010bbae7a)
Call setServerCertificate before store and
delete operations, when serverCertificate
exists.
In demo application, request and
configure certificate when certificateUri
is given in asset.
Fixes#1623