Changed download manager to take |shakaExtern.Request| as input
instead of |shaka.media.SegmentReference| and |shaka.media.InitSegmentReference|
as it really does not need to know about those types.
Issue #1248
Change-Id: I797c437f4339cf670b5eddad14952b0526b72ea5
To make it easier to understand, we collect all the streams within a
period using a map. This ensures that we will have a set of streams.
We then download each stream in the map. Since the map is indexed by
stream id, we can easily connect the variants and streams.
Issue #1248
Change-Id: I65ae01733b5d9dbf8b6d73c37f802320fffa03d1
Made some changes in how the unit tests were structured so
that it will be easier to identify problems with changes to
storage.
Issue #1248
Change-Id: I8331f18e9c9e360cf8057737ddfd71c7152a744b
Adding "mechanism" and "cell" fields to offline uri. But since
they are not used anywhere, this change sets them to dummy values
so that all the constructors could be updated.
Moved the manifest reconstruction code into a instance class as
the mechanism and cell for the asset is needed in order to create
all the segment uris.
Change-Id: I2b5738805b17c4aa33d39b3166fddf1528aed489
The offline uri is going to soon contain more information (routing
information used by the storage muxer) so this change makes offline
uri a class so that all components can be accessed.
Change-Id: I5137f278e0dab059191d450876cab42745e4ed0b
This unblocks conversion of tests to async. We ran into issues in
compiler version v20171203 which have already been fixed upstream.
We are not, however, updating the linter. The matching linter version
reports errors about our tests not using goog.require, which we do on
purpose. We will wait to update the linter until we have resolved
that.
This change also fixes issues discovered by the upgraded compiler:
1. Missing property definition in playhead_unit
2. Wrong type name in storage_unit
3. Wrong type name in FakeManifestParser
Change-Id: I4ba3f43e6a6471e182a69c85cfc619de3380c559
This is an automated fix to be inline with Google style guides, this
was created with eslint's --fix option.
Change-Id: I860eecbc8152603e730aa17a1393f16d26b3b6fc
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
Rather than using the availability window, Playhead should use the
seek range to restrict the playhead's position.
Closes#1224
Change-Id: I8612bfafb53bbb214e32aae2d71af52d748a3aee
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: Ib137fbfde50f1330c74c040fc062aa8e2c6d1e57
Instead of storing uris for SegmentDataDB in SegmentDB, store the
actual key so that we don't need to convert back-and-forth so
often.
Issue #1047
Change-Id: I2f6d1bc1e58abd7a210097dea757d1e2fc9d4cac
Changed the storage remove API to use the offline uri instead of
the stored content as that is all that is needed to remove the
content.
Updated the demo app to remove using the Uri and not stored content.
Change-Id: I72a1049838759452eb16c78c8f1f7f4170e4e841
Removed the reserve id from storage engine. Now adding an item to a
storage engine will return a promise that resolves with the id it
was stored under.
Change-Id: Id4d2c4c51a359593f1308aeb5fe580ab460ebeb8
Before, stored content always needed an offline uri. As the id
will soon not be available before saving to storage, stored
content needed a way to represent content that was being
downloaded.
This change allows the offline uri to be null to represent content
that is being downloaded. It also allowed stored content to be
created from a Manifest (for content to be downloaded) and to be
created from a ManfiestDB (for content already downloaded).
Change-Id: I3039069995f0b061112ed0c636a53ceef5673389
Isolated all progress code into functions in Storage to help abstract
progress from the storage logic.
Change-Id: I7a72c25dbd126cb4a5e682763fb1e46afa0703ef
Changed the Storage Engine interface to know about the types that it
is expected to store. This allow the implementation to do more internally
as the scope of the object has been limited.
Change-Id: I388e2bde5e7e3f99e8b28bd16e08a8f6d5fc6453
Before, segments required knowledge of the manifest and stream to
be created but that information was never used. This change removes
that information from the segments and breaks the circular dependency
between manifests, periods, and segments.
Change-Id: I94064220dd8e3693ff69f5c9100ec1b91aa3c34d
For storage tests, this change isolates the creation logic
so that the data created can more accurately reflect real data.
Change-Id: I8b8a2002c29e5c9d3a41f4de0819ad923b6b14e5
To make it easier (and more consistent) to mock the default storage
engine in our tests, this change introduces StorageEngineFactory and
MockStorageEngineFactory.
StorageEngineFactory is now used to create instances of IStorageEngine
in the library. MockStorageEngineFactory makes it easy to override
specific parts of StorageEngineFactory.
Change-Id: Icd28b7f4913add1318a24f436e54b3c694312d2c
Moved all the logic that is used to construct and parse uris for
manifests and segments into the offline scheme file.
Change-Id: Ie4dbd12256667296e3c67ed0ecf47f1752dd86eb
ArrayBuffer.slice isn't supported with two arguments on Tizen 2016.
This is a temporary fix that can be cherry-picked to v2.2. A better
fix will be handled in a follow-up change.
Issue #1022
Change-Id: Iae6a0b2ef0cf17843f42f22f0ea0962a56e8be68
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: Ic37437a1ad2305bc50a814cdcc562e74703222ac
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
The old definition using a union with a Function causes problems. The
compiler tends to treat this as an unknown type, so we loose type
safety. The new types ensure full type safety, at the cost of needing
to "convert" the spy when it is used as a function.
Change-Id: I98ebd9dffd9cb865d0cf5d03db0fb5d6ea001ed3
Adding the count of channels, as a new field for tracks and streams.
Used for HLS audio tracks.
Resolves#826.
Change-Id: I1448b4a8cfaf6dd798670bb2f0f3981d6c7e40c3
The new isPersistentLicense option was not documented in #878.
This adds docs and renames it to usePersistentLicense.
Closes#873
Change-Id: I59ed32c98660ad7c155392a1708eab98f63131c3
Based on app configuration, we could store protected content offline
without a persistent license. The offline content would then require
a network connection, but only briefly for licensing. This makes
sense in a lot of commuter or airplane WiFi scenarios.
Closes#873
This change is to expose an audio track's role in order to differentiate
among a main / caption / commentary track that shares the same
language.
Issue #767.
Change-Id: I05d38cba2170d0005611cf160b7ae45996fe77dd
The audio and video codecs were combined in Track, so it's hard to
detect whether the track variant has video or audio track.
Changing the combined codec to two separate fields.
Closes#758.
Change-Id: I9fbd0b85830cac306dc09db2d71cf96f77146cbe
The bulk of the logic for gap jumping is handled in Playhead. It
tracks the current buffered ranges and jumps over any gaps that appear.
It listens for a special browser event ('waiting') for when the video
element runs out of playable frames.
This change also removes the logic for jumping gaps at the beginning
of the timeline. This is handled by the more general gap jumping
logic and works cross-browser.
Finally, this updates the buffering logic to only count the amount of
content buffered (i.e. ignoring the gaps). This fixes some bugs where
gaps in the content can result in StreamingEngine buffering forever
since it thinks only a little is buffered.
This includes full implementation of the logic, but this doesn't close
the issue since there aren't any integration tests yet. Those will
be added next.
Issue #555
Change-Id: Id99eb9fe469e8cf2c7464a3d70c3733791e806e0
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 adds a method on Player to get the license expiration times for
the current EME sessions. This also adds the expiration times to the
stored content structure for offline content. This will update the
stored expiration while playing content (e.g. license duration changes
when playback starts).
Closes#727
Change-Id: I18770a79413423695bbb2ed5f31f6b19038a33d2
By default, we will now store all text tracks, regardless preferences.
This not only helps with our demo, but makes sense for applications
that have not bothered to configure the track callback for offline
storage.
This also fixes bugs in the default track selection algorithm,
changes the default audio track selection to fall back on primary
variants in cases where the audio language preference cannot be met,
and adds tests for the default selection algorithm to verify correct
behavior.
Change-Id: Iead0499039e9ec596514aa7577265a7472914621
There are several tests that use fake <video> elements. All of them
have a createMockVideo method. This consolidates all of them into a
fake class that also provides more type safety.
Change-Id: I132c3e4a75676594bcefb60d0b115c00ede03067
There was a bug where Storage would always store every track,
independent of what was chosen. This fixes it and adds a test so this
doesn't happen again.
This also updates the ManifestParser API usage Storage. It was
updated in 2ca962a3 and Storage was not updated.
Change-Id: Id3b8ee143cec6c4d099a9628c90dc3c927ea8625
To better support alternate storage mechanisms, this change abstracts
shaka.offline.DBEngine into an interface called
shaka.offline.IStorageEngine.
DBEngine has been changed to implement this interface, and allows the
addition of implementations that do not use IndexedDB.
Change-Id: I6a94067001ee53049df11cb68604bb57912300bb
Add UI options to select current audio and text language.
Split selectTrack() into selectText() and selectVariant().
Stop automatically disabling ABR manager when a variant is selected.
Add a warning if selectVariant() is called while abr is enabled.
Issue #412.
Issue #626.
Change-Id: I15f1c3c4fdc6d6b641f708fbef19dbcf10cbcfc6
If a key status is 'output-restricted', treat the key as unusable.
In many cases it is, and we have no way of differentiating when it is
or is not. So our treatment of this status should be conservative,
and we should treat the key as unusable. This will prevent
HDCP-related failures that may be caused by adapting to a stream whose
output restrictions may not be met. The hasOutputRestrictions flag on
streams and tracks is now gone.
The caveat to this change is that if content is encoded with the same
key for SD and HD, and HD streams have HDCP restrictions that cannot
be met, we will now consider both the SD and HD streams to be
unplayable, even though we could still play the SD streams. Because
we can't separate the status of the two streams, we don't know for
sure if the SD streams can be played.
We will no longer support such content due to the complexity of doing
so, and due to the risk of playback failures on adaptation to
restricted streams. Streams with different security requirements
should always be encrypted with different keys. Content which does
not follow this best practice will no longer be playable in Shaka
without modifying the player.
Change-Id: Ia29db8efa0b6f83c0376199dea5210c9b468bc40
When storing multiple tracks with the same type/kind/language, issue
a warning, since adaptation does not make much sense when playing
stored content.
Change-Id: I75d1625b2de680ae06728862d27b50272b951b7f