* 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
* 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
* 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
* 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
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
Make the Player exit the buffering state when the minimum
buffering goal between all Streams has been reached.
Closes#166
Change-Id: I09753c88e2ea998e9a794763592254a89bc35af9
* Create SourceBuffer objects in SBM instead of StreamVideoSource.
* Apply timestamp offsets in SBM.fetch(), which allows for different
streams to have different timestamp offsets.
* Improve log messages in SBM by using MIME type information.
Change-Id: Ibad7c91fa5937e053db84b8e2d6e71957652ddc2
* Make IStream more precise by adding more documentation.
* Make misc. docs related to Stream more consistent.
* Remove |minBufferTime| from IStream; use a configuration
option instead.
Issue #147
Change-Id: Ie6261ced49a8f815d270e0ee94af5dc40acff63f
Add new ContentProtection interpretation API that allows applications to
return multiple DRM configurations for each ContentProtection element
and to parse raw ContentProtection XML elements.
This patch deprecates DrmSchemeInfo in favor of DrmInfo. Furthermore,
DrmSchemeInfo will be removed post v1.5.0.
* Replace DrmSchemeInfo with DrmInfo.
* Move Restrictions class definition into its own file.
* Populate initData values from explicit PSSHs without application
intervention.
* Allow explicit PSSHs to differ between Representations
Issue #71
Issue #137
Closes b/23428584
Change-Id: Ib8d6ba630b930ee64f923a3f4a3e518abacccf88
For static content, if the playhead moves to the end of the video then
either the video should pause or loop. Before this patch media timeline
misalignment and buffering detection would sometimes prohibit this from
happening.
* Ensure the MediaSource's duration is >= the end of each
stream's last segment (both before and after timestamp correction).
* Use an append window to keep the MediaSource's duration constant.
* Rework Stream startup so that the MediaSource can be modified
safely during timestamp correction.
* Remove timestamp correction member variables from StreamVideoSource.
* Fix buffering detection when there are no buffered ranges.
* Add sanity checks and improve logging for debugging MSE issues.
* Improve Stream startup documentation.
Closes#155
Change-Id: I6f7a1d15240af62a2282f3f62b29cd3acd5b1873
Make VideoSource configuration more consistent by treating
bitrate adaptation, content restrictions, and preferred
language as configuration options.
Change-Id: I761311dc806b5af8153875b654fc62ca9fd53234
* Rename the RangeRequestTimeout option to SegmentRequestTimeout
since the RangeRequest class no longer exists.
* Fix a few unit conversion errors between seconds and
milliseconds and vice versa.
Change-Id: I8695c3bfb79ae0e20ec5bc75d9ae9f941bccd023
Added a new class called FailoverUri which handles multiple URLs and
switches to others when one fails. This is also handles the request
itself. This replaces SegmentMetadata as well as a number of manual
requests.
The MPD parser now produces arrays of URIs rather than just one. The
MPD Processor then converts it to a FailoverUri inside the manifest.
Added unit tests to test the new functionality and updated the old ones
to the new changes.
This does not support failover on subtitles since subtitles are handled
by the browser.
Closes#68
Change-Id: I5410104827b9e4102b243444b1b5a3f01dcaf10d
* Instead of intercepting specific 'seeking' events to forego stream
resync, record the particular seeks using a member variable, which is
less error prone.
* Don't rely on 'playing' events for stream resync after pause/play:
'playing' events aren't reliable; instead, just check if we need to
clamp the playhead when we update the seek range.
* Don't fire seeking events when starting the video at t=0, or when
there is no timestamp correction.
Closes#132Closes#136
Change-Id: I350ee6e9966af9f44d3e8bda4dc8297271e41855
This updates the extern for Promise.prototype.catch to match the ES6
Promise externs in newer versions of the Closure Compiler.
b/21559591
Change-Id: I796d8293f7be3170e465eaf3f30ceb8c9c5698b6
When our assertion on stream limits fails, the debug code below it
was causing an exception, which broke other things.
This change keeps the original problem from triggering others.
Change-Id: Iacaf5be0134e6c6e0de2b25869013adeba62ba2a
* Move seek range updates into SegmentIndex implementations
and StreamVideoSource.
* Remove unnecessary sub-class hooks from StreamVideoSource.
* Remove internal LiveSegmentIndex timer: do SegmentReference eviction
and generation on demand.
* Rework Stream startup again: consider Streams as started when they
have buffered some minimum amount of content. As part of this, only
apply a timestamp correction to the SBM when the streams have started.
* Defer stream switches until all SegmentIndexes have been corrected.
* Partially revert optimistic "bufferedAhead" calculations in Stream:
check if we've buffered enough content at least every second.
* Make LiveSegmentIndex more robust against a "wrong"
@availabilityStartTime.
* Fix a bug where a positive timestamp correction would trigger an extra
Stream resync.
* Fix a bug in evict_() where the first segment would never get evicted.
* Check stream started conditions in onUpdate_ instead of after a segment
has been inserted.
* Tidy-up immediate/clearBuffer naming and other comments.
Closes#51Closes#109
Change-Id: Ic6f0b96065d3c5dfb5c03ca1c52363bd77b22875
This reverts commit 93aa2ed0e8,
which broke live streaming.
To reproduce, use: spec_runner.html?spec=Player%20live
Change-Id: I734f36cfc1226d34058e70b723e53d607664fb53
* Allow segments from different streams (Representations) to coexist
in buffer.
* Only fetch a single segment at a time.
* Remove id field from SegmentReference and remove SegmentRange.
* Only start the Streams once the buffer is "full".
* Stop DashVideoSource from triggering an extra resync during startup.
* Make Task.abort call order deterministic.
A follow-up patch is required to handle certain seek patterns in
live streams.
Issue #51
Change-Id: Ib7c9021471f1ed89323f19764463202b119cb491
This patch reworks SegmentIndexes so that any SegmentReference they
contain is guaranteed to be available. This makes SegmentIndexes work
consistently between static content and live content (specifically
content specified using SegmentTemplate with @duration).
* Rework StreamInfo to use a ISegmentIndexSource and a ISegmentInitSource,
which construct a SegmentIndex and an intiailization segment
respectively.
* Make ManifestInfo destructible and various async operations in
StreamVideoSource safer.
* Introduce LiveSegmentIndex, which manages SegmentReference eviction.
* Introduce DynamicLiveSegmentIndex, which manages SegmentReference
eviction and generation.
* Implement improved segment availability logic for segment eviction.
* Move SegmentIndex construction from MpdProcessor to several
ISegmentIndexSource implementations.
* Use a SegmentIndex to represent subtitles to simplify Stream creation
in StreamVideoSource.
* Move manifest update code from StreamVideoSource to ManifestUpdater.
* Move PeriodInfo.duration determination in MpdProcessor to StreamVideoSource.
* Since "forced" manifest updates are no longer required for content
specified using SegmentTemplate with @duration, simplify manifest update
code in DashVideoSource.
* Make Stream continue to update even if it runs out of
SegmentReferences, this simplifies previous resync logic and makes
DynamicLiveSegmentIndex work seamlessly.
* Refactor SegmentIndex and initialization fetch code in ContentDatabase.
* Download all SegmentIndexes in the background after the initial streams
have started.
Follow up work is required to remove seek range logic from
DashVideoSource.
Change-Id: I4a908195aba632a911a6e55213fc41d41428162b
If the user's preferred audio language is missing, and there are no
subtitles in the user's preferred language either, do not enable
subtitles by default.
Change-Id: I57e7ba3679758bbd0e8f460767913d090d0d5630
Strip extraneous minBufferTime copies.
Default minBufferTime in MpdProcessor if missing.
Pass minBufferTime as a parameter to Stream.start().
Keep a buffering goal separate from minBufferTime, which will only
be used for stream startup (as intended by the DASH spec).
This allows us to startup quickly and still buffer ahead.
Relates to #51.
Change-Id: I94b6b2566419344fa761ff75b0884719f255cd66
This reduces flakiness around inaccurate delay() calls.
Also:
* Changed some tests to avoid a playbackRate race.
* Reduced the playback rate in one test to improve stability.
* ...?
* Profit!
Change-Id: I452f6eb3b7f331c973a8d20b436ecab2b5576f21
Fix a number of error cases which caused failed assertions
and erratic behavior.
* Handle EOF in resync().
* Handle aborted clear() in resync().
* Ignore 'seeking' and 'play' events from onStreamsStarted().
* Handle empty SegmentIndex in setTargetUpdateTime_().
Change-Id: Ia1fafff068cae238eaeca0cee06391a3a837514a