Went through all the class in shaka/offline and removed all uses
of |MapUtils.values|. This required changing many uses of Object
to Map.
Change-Id: I6bd6d37009e7b32ea38e9cbabd64c2d36ffeabbc
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
Changed the ClosedCaptions field in Stream from an object to an
array of ClosedCaption objects, so that it can be iterated through
and accessed easier.
Issue: #1404.
Change-Id: I67980cf4d5b5746785ba29f95718970fe89056f4
There was a stream utilty was that only be used in one class
(another utility class). The method was to get tracks, but it
sat along side other methods that look similar but were different
in very small ways.
This change moves that function to be in the same class as where
it is used so that it will be less distracting from the other
getTrack methods.
Change-Id: I21737b6b1341c06b41e6016e24b2b20ce5d40e77
When moving the manifest validation code, an error that was
meant for no periods got moved to no variants.
Change-Id: I2049e527baf247a7ec0281bcb443da6a2f20710b
There was an ugly promise chain in Storage.loadInternal. This change looks
to clean up that promise chain and to use async syntax instead.
Part of the refactoring splits |loadInternal| into two more focused methods
as an effort to make the code easier to understand.
Change-Id: Ica113344c6c4ba1d82b6cee281268e20be1aa411
I was looking at some of the storage code and got confused with
when and where we were filtering the manifest. After spending
a lot of time trying to map it all out, I found that it would be
easier to understand if we:
1. Did all the filtering at one time.
2. Did all the filtering before trying to download anything.
Change-Id: I377fbeaa1873ae3fccff438ffcb10b3fb53f48d9
Before, we would need to pass a manifest to DrmEngine to initialize
it. This was a problem as we look to support playback via src=.
When looking at how DrmEngine used the manifest, it appears to just be
a simple way to pass in the variants and the offline session ids. By
changing DrmEngine to accept the variants and offline sessions ids, we
can break the association between DrmEngine and Manifest.
Issue #816
Change-Id: Ie0dc82aaec871d7e6e002fe59b3a984449eda8c7
We renamed the extern namespace, but these references were in comments
that were not examined by the compiler.
Change-Id: If232953f678fba703c5355445f4f0cf180b46749
There are two intents when we initialize Drm Engine and the meaning
of the parameters are nuances depending on what you are trying
to do.
This change creates two different initializing methods so that
initializing drm engine for the intended purpose can be more
clear.
With this, some internal naming was change to better reflect how
some variables were being used to give them a bit more context.
Change-Id: Id8925eca53a34fe870ba5c973f9f0bb584f6e2d6
Before, segment timestamps were used in PresentationTimeline without
regard for the period start. This means they were not truly relative
to the presentation, but to the period.
The "isFirstPeriod" argument was also broken. It was meant to be true
for segments from the first period *ever*, but was passed true for the
first period *in the latest manifest update*. So data calculated from
that was bogus for live streams.
Now, notifySegments() is supplied with a period start time, so that
segment references can be combined with the period start to give
presentation timestamps. This fixes a major issue with the original
fix for #999.
Closes#999
Change-Id: Id0fe450f3ce4f90a2387d7103c75eb88f0c69c72
This change allows storage to be initialized without a player instance.
Since Storage is the same post initialization, the only test being added
is a test that checks that the storage instance was successfully
initialized.
Close#1297
Change-Id: Id2588696eac2a866bba74278322727b1d91f56eb
This changes Storage to use the destroyer object to manage
clean-up. This will later be used to change how we destroy
storage depending on how it was initialized.
Issue #1297
Change-Id: I7e8c4f959a6764859504b0259bd5e815e5fd3dc8
Some of these issues were found by the Closure Compiler linter,
which we are not currently using here. I will try to re-enable it
in a follow-up change.
Change-Id: Ie6e75f2b5a1e0f888c3dfbc78ed9cf254d2738bb
The DASH parser will now expose Representation IDs via new fields in
the Stream and Track objects. The "id" field will continue to be a
unique, auto-generated numerical ID, and will be supplemented by a
nullable string containing whatever was originally in the manifest.
The HLS parser will now expose the NAME attribute in the originalId
field as well.
Bug: 112087288
Change-Id: I6b8107d27780fb97ab18de767f7abdc6c7110fe7
We store the references to player's networking engine and
configuration in Storage, so there is no reason to call player
anymore. This change removes those lingering calls.
Issue #1297
Change-Id: I3486ffcb60cd80fd765259d690091cc3267bb8ba
Added two new stream utils for practices that pop up multiple
times in our code base.
1. getAllVariants - Get all the variants in a manifest.
2. getVariantStreams - Get all the streams (audio and/or video) back
as an array.
Change-Id: I87fa4959e4a17dcfff20d5aa0678e6dc346d413e
There was a cast in Storage.deleteAll that really should not
have been there. This changes it to use an assert to ensure
that the case is exposed if done wrong.
Issue #1297
Change-Id: I21f9737c0fc79c2b4324a7385a2814f94f40f884
Allow users to get access to the networking engine that storage
instances are using.
This is part of allowing storage to be used without a player instance
as it will allow users to configure the networking engine when they
create a storage instance without a player instance.
The code still assumes that Storage should never destroy the networking
engine. This is something that will need to change when storage can
be initialized without player.
Issue #1297
Change-Id: If8d1642259e0cf24cb43f2ca7936227e8d939260
As part of the effort to allow storage to be initialized with or
without a player instance, this change moves the offline config
into the player config and changes storage to share a configuration
object with a player instance.
We opted to share the instance between the two classes because if
storage was initialized with player, the initializer is implying a
relationship between the two objects and therefore configuration
changes should be shared.
Issue #1297
Change-Id: I991365255e63c284fbfcf147cf63c9588dd764ab
Added an option for the mime type to be passed to the load function.
Going forward this will replace the option to pass in a manifest
parser factory.
This is to help with issue #816 as passing in the mime type will be
one way for the player to know if it should use src= over MSE.
Issue #816
Change-Id: Ic356bb9f52c3977620debc8d4a09b7115a81d516
When reading through player I saw we did something like:
let variants = period.variants;
...
shaka.util.StreamUtils.applyRestrictions(period, ...);
...
doSomething(variants);
This causes some confusion as it was not clear if |variants| would
still be valid to use (i.e. could applyRestrictions) change the
reference in period like we do in some other filter functions.
So to help make it clear that it doesn't, I have changed
applyRestrictions to accept a variant array rather than the period.
Change-Id: I6dc080a1b1e563e5dd2789bd00fb0cfeb7de41de
Track all open operations in |shaka.offline.Stroage| so that we
can wait on them in |shaka.offline.Storage.Destroy|.
Change-Id: I648cb18545f9f1e0745ffddd70baac8fc316b0cb
Created the Destroyer class to handle working with IDestroyable so that
IDestroyable can be a simple interface (no more static methods).
Change-Id: I5afd915b895a4c60d758475a2b879bf0eb0096c9
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
Before, when clearing storage with Storage.deleteAll, offline
licenses were not released. Now before erasing storage, all
sessions ids are collected and requested to be removed.
Closes#1277
Change-Id: Ib88a14f5132d3b2a34bd339cc45f121792b65ebc
Tracking progress when removing an asset was missing from the new storage
system. This CL adds that support back.
Issue #1248
Change-Id: Iab275cd75af817cfc34ee0888ddeea257b1ead56
This CL replaces the old storage system with the storage muxer system.
In addition to replacing the old system, this CL removes all the
code that was only used by the old system.
As of this change Storage Muxer support shaka player's V1, V2, and V2
indexeddb schemes and exposes a plug-in system for other offline storage
components.
Issue #1248
Change-Id: I1a4914477ad8db29fd0e7ad7de2f149b6497f67e
While working with integrating storage muxer into the codebase, there
were some painful points in the API. This change addresses those
painful points.
1. Getting cells - many times we know that the cell should be under
a specific path. So resolving the path and
checking for null got annoying. This adds
a call that assume it should find the cell.
2. Get active cell - when getting the active cell, we often need
the cell and the path to the cell. So this
creates a "Handle" which pairs the cell and
path together.
3. Adjusting registry - when testing we need to change what storage
cells are actually available. Instead of
unregistering and registering cells, this
adds methods to add and remove a temporary
override.
Issue #1248
Change-Id: Ifd45ee5912f53b1da444476b560cf03669a19b11
Need to close database connections when destroying the
indexeddb storage mechanism or else it will get in the
way of deleting the database.
Issue #1248
Change-Id: I56466851e8172282c60c3128e5b4113001a10970
Create the indexeddb storage mechanism which will allow us to
connect to indexeddb storage cells. As we don't have a V1 Cell
yet, this only connects V2 and V3 cells. However the code does
assume that V1 will be added and only omits connecting the cell
when it sees the V1 object stores indexeddb.
Issue #1248
Change-Id: I7395b8a334cd68795aab02ff656a5b49d1f5742b
This upgrades to the latest compiler release and drops the linter.
Since we adopted it, the closure linter has produced far more problems
than it has caught. It takes no command-line arguments and can't be
configured. Eslint takes care of traditional linting tasks, and it is
unclear what we would stand to gain by conforming to the demands of
newer versions of the closure linter.
This also fixes a few issues caught by the new compiler:
- Type adjustments for the evolving Fetch externs
- Drops our custom extern for AbortController, which the compiler
now has built-in
- Adds a type annotation to player.js to fix a type inference
failure in the new version of the compiler
- Drops more non-nullable annotations on functions, which are
implicitly non-nullable
Change-Id: Ia03936a5426277d970612c0eacef40fbaf6ee35d
Limit the scope of storage and download manager to |store|. This
will make it easier to swap it with storage muxer.
Issue #1248
Change-Id: I3ec5de4457cbb534eb0c9b44d518602a1295d709
Added a method to get a cell from storage muxer. Unlike resolve path
this will return a rejected promise if the cell can not be found.
Issue #1248
Change-Id: Ia594b7741351d515e564e574321e49ad51073005
Added a toString method to StorageCellPath so that it will be
easier to read when added to a string.
Issue #1248
Change-Id: Iad7c2e633b6327bd39475d29d23426217f042ee3
Changed |findAll| to |forEachCell| as it provides better usability in the
codebase where we would have used |findAll|.
Issue #1248
Change-Id: I6ca993ffb85aa0bf15d6ac250ac85a00e966fcbe
Make storage muxer implement the IDestroyable interface so that
it can be used with |shaka.util.IDestroyable.with|.
Issue #1248
Change-Id: I6e8c71b57e939ea30d5c24c75ede9c2de80026db