This will help with porting to IE11. Chrome, Firefox, Safari, and
Edge all have native Promises.
This polyfill does not support thenables because Shaka does not use
them. Other than tests related to thenables, this polyfill passes
the A+ test suite.
It is also worth noting that this polyfill is incompatible with
native Promises, so it should not be used to replace a native
implementation or mixed with browser APIs that may use a native
implementation internally.
To safely test in Chrome, force prefixed EME (to avoid native
Promises), set window.Promise to null, then load some content in
the test app. If using a verison of Chrome after prefixed EME
was dropped, use unencrypted content.
To run the A+ test suite, compile the library, install nodejs and the
module 'promises-aplus-tests', then run ./test_promise_polyfill.js.
Inspired by pull #176
Change-Id: I0d25049f162ff7f3b57bbc795403fcdedf927262
These keys cannot always be used as keys, for example on IE11 where
very large init datas are found in PlayReady content. Since there
should not be a large number of unique init datas, a linear
suppression pass and a quadratic removeDuplicates should not be a
problem in practice.
Related to pull #176
Change-Id: I9dd9b5e45422544c86dd95686766625a0b336963
* Supports live streams of a fixed length.
* Live streams that stop now correctly end the video.
* Only uses local MPD when @availabilityStartTime is in the future.
* Added configuration option liveStreamEndTimeout.
A live stream is considered "ended" when the play-head moves past
the last segment for liveStreamEndTimeout amount of time. This allows
the MPD to be updated with new segments.
Closes#139Closes#140Closes#145
Issue #172
Change-Id: I0675203931f35ca3e0dee60a87c54ba74cbdbaea
* Document timestamp correction better.
* Add additional API details to Stream.
* Tidy-up and make comments/docs more consistent.
Change-Id: I41d873967a930634fa48c83fe65b6e9cf512d782
When the availabilityStartTime is in the future, the
StreamVideoSource will re-process the local MPD once the
availabilityStartTime passes.
Closes#172
Change-Id: I1432ae06fbff6c4978ed93bc51263f7cac37e136
For static content that uses SegmentTemplate + @duration, compress
the last SegmentReference so that it does not go beyond the
Period's duration.
Issue #173Closes#187
Change-Id: Ifb9404ddfe267915541c035a5d6286f63f7bc032
* License errors in store() are reported as a failed promise.
* store() cleans up after errors.
* Added argument to deleteGroup to ignore session errors.
Change-Id: I8030d89a7f99cabb6ecb7840a854a0452a2f2ef2
* Give key status errors type 'drm' for both DASH and HTTP.
* Include the EME key status code for HTTP for testing
purposes.
* Make error reporting between DASH and HTTP more consistent.
Change-Id: I8c42dbf08257cc88c6e089d817f55f0caa575473
* Ensure AdaptationSets with different languages but with the same group
end up in different StreamSetInfos.
* Set the main flag in a StreamSetInfo if any one of the source
AdaptationSets has their main flag set (commit
689c2a47aa broke Role 'main' support).
Closes#182
Change-Id: Ia017e294e0b359c62133adc42a8d701d614f3b0d
* Fire an error event when all audio/video tracks are restricted
during playback.
* Fire an error event and fail gracefully when all audio/video tracks
are restricted before playback (requires calling player.unload() when
the VideoSource's attach promise gets rejected).
* Rework AbrManager so that getInitialVideoTrack() can be called before
starting bandwidth monitoring.
Closes#170
Issue #179
Change-Id: I4ac6cdf2a4c862e0d0560dff2f2d7bb6801bbc38
Some versions of the compiler do not seem to recognize this as
unreachable, so add a return to satisfy the compiler and silence
the warning.
Change-Id: I55485d2847616be696b6c4f908e2042cb4c00392
* Updates all Copyright years to 2015.
* Adds licenses annotations to all JS.
* Makes all licenses identical to avoid repeated appearance in the
compiled output.
* Drops fileoverview annotations, which do not affect docs output.
* The linter still requires fileoverview on externs.
This patch required a newer closure compiler, since the previous
version we used had a bug regarding license annotations that caused
the license comment block to appear in the output once per file
regardless of uniqueness.
Change-Id: I2e9272db680cba7ecc4613d97f1d3a94ac2244cc
This reverts commit 8cb24652cb, due to
the fact that the new annotations caused our binary size to jump
by 52%.
The compiler preserves all 'unique' licenses, which causes trouble
since the comment blocks with the license annotations are not unique
and contain file overview comments as well.
We can re-examine this once we have restructured the license headers.
Change-Id: I418e407a0e0253630633697f30cf496a7fc2ddfc
Allows blank license server URLs for offline playback and marks
loaded streamInfos as usable by the key system.
Change-Id: I67f346729e55bb661fdefa554876642bab951ac7
If a session becomes "ready" more than once, there is a race where
it can wind up in the database multiple times. This eliminates
duplicate session IDs on both load and store, which avoids an
"unexpected completion" error from Chrome's EME implementation.
Change-Id: I749364cb12787a9c72324b2ad95adaf8ce1a00af
The trackschanged event fires when restrictions are updated
so in order to quickly apply restrictions when network
conditions are not changing, simple_abr_manager listens
for this event and selects a new track if required.
This extends the work started in 97769bd, where we missed points
of failure in EmeManager.
Closes#151
Change-Id: Ie7f0e3512f3636165d0073b4d4166f9882c3406f
The underflow threshold was too small (measured 0.13s buffered during
underflow), and the minBufferTime was unnecessarily large.
Change-Id: I468a010a5f30ad64ccde8ce05d6482b02e71b9d4
There was a static method on OfflineVideoSource which forced the
compiler to keep ContentDatabase in the build.
This fix increases the savings for a no-offline build from 488 bytes
to 9592 bytes, an increase in savings of 19.6x.
Change-Id: I24816e83249da9aef7ace07886723575ad4f23b5
This introduces a new method on PublicPromise called destroy(),
which does for Promises what destroy() does for the other classes:
shuts down async processes and cleans up references.
In addition to catching errors and shutting down more cleanly in a
wider array of circumstances, this may also help with GC, since we
no longer leave pending Promises around with handlers attached to
them.
Closes#151
Change-Id: I205c5979418fbc18cd7e35d91d0de2746f337137
Use 'keystatuseschange' events from EME together with cenc:default_KID
from the MPD so StreamVideoSource can determine if the key system
can/will decrypt a stream before it attempts to play it. This enables
the Player to safely (and automatically) switch between streams that
are encrypted with different keys.
Support AdaptationSet @group, which is the preferred approach to safely
use multiple encryption keys over multiple Representations.
* Squash AdaptationSets from the same group into one StreamSetInfo.
This enables support for @group without introducing special case code
into StreamVideoSource and EmeManager.
* Fire 'trackchanged' events when tracks becomes available/unavailable
either from application restrictions or key status changes.
* Pull key IDs out of DrmInfo and put them into StreamInfo so key status
changes can drive per stream availability instead of per StreamSet
(AdaptationSet) availability.
Closes#67
Issue #160
Change-Id: Ife0814deb65715923a572b45880137a99b378035