The DASH parser was not always correctly deducing the content type.
For unspecified content types, the type can be deduced from the MIME
type. For example, video/mp4 is video, and audio/webm is audio.
For text, things are a little more complicated. Text types do not
always start with text/. In particular, embedded text, such as VTT
in MP4, have a MIME type that starts with application/mp4.
To deal with that, if we see an unknown type, we ask TextEngine if it
supports it. If so, we deduce that the content type should be text.
This check against TextEngine was only happening for MIME types
specified on the Representation, but not on AdaptationSet. This
replaces a weaker deduction in the general frame parser with the same
TextEngine check we were using elsewhere.
Furthermore, Player mishandled the content types it passed to
AbrManager. AbrManager will only choose audio, video, and text
streams. It ignores all other types. Player, meanwhile, threw a
confusing error if AbrManager failed to choose some of the types
passed to it. Therefore, Player should only pass audio, video, and
text types to AbrManager.
This fixes both issues and adds new unit tests for both.
Closes#631
Change-Id: Ib1311d37d00c3989367fd066f66e1eba85652e40
Error codes do not get reused, because that could create confusion in
bug reports.
To make it easier to add new error codes, we should keep track of
retired error codes. This adds placeholder comments for all of the
error codes which are no longer in use.
Change-Id: I70eca30d3108e35d9db388f4372189ab7c014f92
Before this, an empty manifest (no periods) would result in a
TypeError from the containsInband computation. This corrects the
computation and introduces an explicit error for empty manifests.
Closes#618
Change-Id: Ie9b740dbfa4ffcafbf99541bf03fa68cfae2bf88
Text parsers can easily be changed during playback, unlike the
browser's media decoders. Whenever we change text tracks,
reinitialize the text parser.
This also removes restrictions on text tracks of different types
when we filter manifests.
Closes#571
Change-Id: I3c243dde951cd04554c2fa1be2c8ebf06988791b
An upcoming compiler release will allow us to generate externs from
exports. Because of that, we are adding some extra exports which are
otherwise not needed at runtime.
- Export properties which implement an interface
- Export classes which are referenced in external APIs
- Export base classes of other exported classes
Change-Id: I78b3a4569b4b82b0a9d8993978faf268c2a791d9
Type compatibility checks are important for multicodec or
multicontainer content, and there's no good reason to exclude text
from those checks. The new Axinom v7 test vectors have multicodec
text (both mp4+VTT and mp4+TTML).
Change-Id: I999aaf5b37cda8a9243538b4dd21c503df33dcb9
Behavior for IPR streams:
* offline storage disallowed
* segment references will not be stretched to the period
* seek range starts at 0
* seek range end is calculated like the live edge
* seek bar is from 0 to duration, not the seek range
Closes#477
Change-Id: Ia36874bb7208c2473c79cb817395ce03925b8c95
In many places we tried to guess the encoding of a piece of text.
This guess fails for Chinese UTF-8 text, and probably text in many
other languages.
However, DASH manifests, TTML files, WebVTT files, and VTTC box
payloads are all specified to be in UTF-8. Rather than guess and
possibly fail, treat all text in these contexts as UTF-8.
Change-Id: I00c652a9f1dd20855e94abfac84275e41dd9e266
When a piece of content has several StreamSets with the same
language and role, pick an audio set with lower average bandwidth,
pick a video set with the highest top resolution. Pick the first one
when the above is not applicable.
Closes#476
Change-Id: Id2cb9095994e8aa6b205024504a5d665f8656437
Look for EMSG boxes in segments if the manifest signals their presence.
Update the manifest when a DASH EMSG box is encountered.
Dispatch an event with the content of the box for all other EMSG boxes.
Closes#259
Change-Id: I874121207c2419e756980ac858fba0d56e68e07e
For content without a clear lead, the order of 'waitingforkey' and
'keystatuseschange' is inconsistent and causes false positives for the
WRONG_KEYS error. Without an obvious inverse for 'waitingforkey', we
will have to drop the WRONG_KEYS diagnostic error.
See also: w3c/encrypted-media#284
Change-Id: Icc1c420ff5d177a0329db244a6b28e99820a5221
* Suppress WRONG_KEYS errors when output is restricted. This is a
false alarm in these cases anyway.
* Throw a restriction error when the ABR manager fails to choose
streams for some content types.
* Rename ALL_STREAMS_RESTRICTED to RESTRICTIONS_CANNOT_BE_MET to
reflect the way restrictions actually work. We cannot play if all
streams of any one type are restricted, not just all streams in the
period. (e.g., all video restricted is a failure, even if audio is
still playable.)
b/30290503
Change-Id: I6de48950d33f241b7df1161052d60b89f962649f
* Drop unnecessary type alternation in SegmentIndex unit tests
* Drop unnecessary bind in StreamingEngine unit tests
* Drop unnecessary expose annotations in Pssh
* Add comments about quoted access in cast unit tests
* Move afterAll() position in cast unit tests
* Make return type for PublicPromise constructor more specific
* Define a type for Util.eventLoop return value
Related to PR #421
Change-Id: I092a8ff366b4ac4ea868dd3f4fbe4e3d63a2167f
Wait to send a WRONG_KEYS error until key statuses have propagated.
Also, check for expired keys and fire the EXPIRED error from the key
status handler, not from 'waitingforkeys', which is not yet available
everywhere. The EXPIRED error will suppress any WRONG_KEYS error that
might otherwise fire when 'waitingforkeys' happens.
Finally, do not trigger track restrictions based on expired keys. This
means EXPIRED will never be followed by ALL_TRACKS_RESTRICTED.
This provides more deterministic behavior in tests and clearer
diagnostic signals for app developers.
Change-Id: Idd0f91fdd6442125661b9593ecaad0b57b81625c
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
SimpleAbrManager will now leave 5s of video ahead of the playhead and
clear the rest when upgrading to a higher resolution.
Also smooths transitions for overlapping segments by scheduling an
abort() call to reset MediaSource internals after removing content or
changing the append window.
Related to issue #435
Change-Id: Ie036515388e1e7e4b3b8f3ab9922e3d5e7ed2627
Original Chromecast devices can output a max of 1080p, and may have
issues digesting higher resolution content. Since higher resolution
content would be downscaled for display anyway, limit Chromecast to
1080p to avoid both decoder issues and wasted bandwidth.
Some Cast devices may support UHD content, but the max res for
Chromecast is currently hard-coded until we have a way to detect a
device's capabilities at runtime.
Issue #261
Change-Id: I3dd093b07f9a964116f81422f3c298dfbf7e2e52
This introduces Chromecast support directly in the v2 library, as well
as in the demo app.
See the included design doc for details.
Issue #261
Change-Id: I26a707e7fa6bd829c3ebc70e4c9345ec25eed000
Also involves some cleanup:
- Differentiate between WRONG_KEYS and EXPIRED.
- Fix session expiration detection for CDMs without sub-second
time resolution.
- Export accumulated key status over all active sessions.
- Update DrmEngine workarounds with bug links.
b/29919059
Change-Id: Ia4f12657285b0d431ed7a0c22ee4312375fdd40e
Now the Storage class can store protected content and play it back.
When deleting it, the offline EME sessions will be removed. Also
now offline support appears in Player.support().
Closes#343
Change-Id: Ic5b5a0e0854d80f7821e04e751275abf40ee6eb6
This contains two major parts: the Storage class, which manages
storing, listing, and deleting the stored content, and the offline
manifest parser, which loads the stored content into a manifest so the
Player can play it.
This does not include support for storing encrypted content. The
EME sessions will not be stored properly and will fail to play.
Issue #343
Change-Id: I7ecb3400391ec8100155aa972f9b09bb7ae24d9d
This adds a new abstraction to cancel simple Promise chains.
It is intended to help resolve load/unload/destroy issues. At this
time, only player.load() is cancelable, and only by destroy(),
unload(), or other calls to load().
Change-Id: Ib82dbef863cb2edc6881a8d433d5a02096e06aed
Before, the same error was used for no available configurations or
key systems and for missing key system URI. Now there are two
different errors. Also elaborated on the error in the documentation.
Closes#371
Change-Id: I9b72daa0a99b4761714a74c3ceba60c873c89a77
Some streams have the same mime type, but incompatible codecs. For
example, mp4a.40.2 and ec-3. Once a stream has been selected, filter
out incompatible codecs.
Closes#391
Change-Id: Id3f5521cb3f995d88d93255c0bc5cfda8e239fcd
Representations without Segment* elements or which do not
specify "text" as their type are now ignored instead of causing
failure.
Issue #368
Change-Id: Ica6490442dc38c7fdbc778eb0650dd7909d764c5
This is part of the v2 equivalent of the ContentDatabase. This only
manages low-level interactions with the IndexedDB and wraps all
actions in Promises.
This also adds an in-memory version that is used for testing.
Issue #343
Change-Id: I0d296639e74c1d4cab232ce7248b03a353b38b3c
Before, Player.configure would check the number of arguments for
the functions being set and reject those with an incorrect count.
However, this does not work with jasmine spies. So instead allow
it but log a warning.
Change-Id: I0f03ae9a22bf6a6e427c2a26a6f055dcaa40b3ec
* Set this.parser_ to the correct property in load()
(stops old manifests from being fetched).
* Stop load() from unloading first when the Player is a new instance.
* Handle multiple repeated calls to load().
* Fully cleanup after partial loads.
* Add additional destruction checks.
Issue #369
Change-Id: I43d5ed90c8119b1040b87a0dc187f52738e1c683
MediaSource may throw QuotaExceededError if it cannot append a
segment. Now, StreamingEngine will catch these errors from
MediaSourceEngine and reduce the buffering goals to avoid
encountering additional errors.
Closes#258
Change-Id: I1d957831424a4a6fb2681ee2c4f9ed7db7bf1711
If a key is output-restricted it may still be usable.
So, instead of disabling these tracks, indicate that they
may be playable.
Issue #199
Change-Id: Ic13a02d97ccc21533118f17aa907c16d1cda05ce
This moves a bunch of code out of Player into different files. This
is needed to allow the new Storage class to have the same behavior
as Player. This also reduces the size of player.js.
This moves the following code:
* Determining the manifest parser to use.
* Period filtering.
* Application track restrictions.
* Configuration object merging.
* Choosing initial stream sets.
* Track creation.
Change-Id: I84d68d39b487447d6f8d61a145cd034a88165739