Commit Graph

2275 Commits

Author SHA1 Message Date
Timothy Drews 0a6baab9db Improve Stream docs; rm minBufferTime from switch.
* 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
2015-08-24 13:44:48 -07:00
Timothy Drews 1c58dee0c2 Add new ContentProtection interpretation API.
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
2015-08-24 10:41:41 -07:00
Timothy Drews f7d1a2dc73 Improve error reporting for unplayable content.
* Reject fetch() Promise in SBM if appending a segment doesn't
  actually buffer the segment.
* Remove an 'assert' in Stream that was triggering for self-initializing
  streams.
* Improve log messages in Stream.

Change-Id: I8c74ae24948e7a8fc2bd7539f617a7932a2b9f43
2015-08-24 17:27:13 +00:00
Jacob Trimble e74ad98eaa Added setNetworkCallback method to dash and offline video sources.
This allows the app to intercept media requests to modify its URLs.
The callback accepts the URL for the request and returns a modified
URL or null to use the original.

Closes #148

Change-Id: I08352754ace05f318706fd93910097c0fa7696f0
2015-08-24 09:35:27 -07:00
Timothy Drews 47948f49e5 Fix double Promise resolution in TextStream.
Change-Id: I7fe6de135775afa10c081a9d7d7b308e46c6b486
2015-08-21 18:21:44 +00:00
Timothy Drews e02f74a492 Add destruction check in Stream.switch().
This check is necessary since Stream does not own its StreamInfo,
so the async part of switch() may complete even if
Stream.destroy() is called

Change-Id: I5185c0df3184924d0f34d39e235b1155f01dd273
2015-08-21 17:24:06 +00:00
Joey Parrish df29182007 Merge pull request #161 from sanbornhnewyyz/master
Correct typo in getAdaptationEnabled causing it to return undefined
2015-08-20 15:30:20 -07:00
Sanborn Hilland b45a7dff33 Correct typo in getAdaptationEnabled causing it to return undefined 2015-08-20 17:33:21 -04:00
Timothy Drews c741b69df6 Fix typo in failover_uri.js
Change-Id: I6f48d3ed0f79974cac06f419f3c542b55d332101
2015-08-20 10:58:58 -07:00
Timothy Drews f5c4eb1667 Improve end-of-stream behavior.
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
2015-08-19 09:30:00 -07:00
Timothy Drews 4d2a26d33a Make VideoSource configuration more consistent.
Make VideoSource configuration more consistent by treating
bitrate adaptation, content restrictions, and preferred
language as configuration options.

Change-Id: I761311dc806b5af8153875b654fc62ca9fd53234
2015-08-17 22:20:50 +00:00
Jacob Trimble e0e6621d21 Changing the text track now fires AdaptationEvent.
Closes #147

Change-Id: Idd57ada8155273db50f422096f2d40b8bce38230
2015-08-17 20:54:02 +00:00
Timothy Drews 9070446915 Export StreamVideoSource.get*Tracks methods.
This permits offline on the demo page in compiled mode.

Change-Id: I4901370b5c5614e13220d06a751c6b695c341a6c
2015-08-17 20:33:28 +00:00
Joey Parrish 1e33fa2a00 Do not retry fetch if destroyed.
Closes #156

Change-Id: I1d50bbc5d3b00c0d472182435760616e8f1d37fa
2015-08-17 11:58:59 -07:00
Jacob Trimble 671611ef37 Added build options to disable unneeded features
build.sh now accepts several arguments that will  disable features
that will not be needed.  The default is to include all features.
Part of #116.

--disable-offline
--disable-dash
--disable-http

Change-Id: Icdaf82b322debbdc1e898e93c539e35894678a8d
2015-08-14 15:58:00 -07:00
Joey Parrish 88c38cb278 Remove clearkey alg, no longer required
See w3c/encrypted-media#48

Change-Id: I85062d5842b46855168cc85b131972415c2a2120
2015-08-13 20:01:25 +00:00
Joey Parrish fd49592c8d Change fake key ID
New value recommended in w3c/encrypted-media#32

Change-Id: I66d0b1f99630726222f01278d78e69fe26d39f83
2015-08-13 19:12:15 +00:00
Timothy Drews 97809a008a Rename RangeRequestTimeout opt. & fix unit convs.
* 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
2015-08-13 16:41:27 +00:00
Timothy Drews 2699080474 Change mode on i_abr_manager.js to 644.
Change-Id: I9ae5ca72b91e6b76fa008c996f91b14b48f5b9ac
2015-08-12 18:19:23 +00:00
tdrews 7d308a15db Merge pull request #144 from blinkbox/pull-request/clear-buffer-on-switch
Optional offset param to IVideoSource.selectVideoTrack for partial buffer clear
2015-08-12 09:45:45 -07:00
Jono Ward d5d43c671b Add optional offset param to IVideoSource.selectVideoTrack, which allows a partial clearing of the buffer to occur 2015-08-11 13:50:50 +01:00
Jacob Trimble 899c322995 Added support for multiple BaseURL elements.
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
2015-08-10 16:01:06 -07:00
Timothy Drews 7623b58fea Fix ContentDatabase/AjaxRequest circular dep.
The circular dependency,
ContentDatabase -> RangeRequest -> AjaxRequest -> ContentDatabase,
causes issues for the upstream Closure compiler. This patch breaks that
cycle by factoring out reading and writing operations from ContentDatabase
into ContentDatabaseReader and ContentDatabaseWriter respectively.

The following minor changes have been made to code that has moved:
* Removed retrieveInitSegment() since it's not used.
* Changed .stream_ids to ['stream_ids'] in retriveGroup().
* Reworked deleteGroup() so that it doesn't depend on retrieveGroup().
* Made deleteStream() private.
* Made minor formatting changes to meet the 80 character limit.

Change-Id: Idfc5d04ad32225a915b1531e0f4205137de5cc73
2015-08-10 14:23:32 -07:00
Yohann Connell 94937d7081 Changes to fix compile errors when using the upstream Closure compiler.
Change-Id: I57b4ae73bdb1980938c3a740904e18da46c6ba23
2015-08-05 15:46:40 +00:00
Natalie Harris a41e6438d6 Make setPlaybackRate behavior consistent. Closes #138.
Change-Id: I6a4be5acd37b42fb92bddc896009ae48cb92b5ec
2015-08-04 11:43:47 -07:00
Natalie Harris 3936bfafb6 Player configuration should not use static variables.
Closes #126.

Change-Id: Ib8ef19e46918276f28d6539a158517f8558867d1
2015-08-04 08:51:22 -07:00
Timothy Drews 263ea9985d Re-work seek handling during stream startup.
* 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 #132
Closes #136

Change-Id: I350ee6e9966af9f44d3e8bda4dc8297271e41855
2015-08-03 11:16:26 -07:00
Jacob Trimble f610cbf4c9 Added support for SegmentTimeline inside a SegmentList.
A SegmentTimeline can appear inside a SegmentList and describes the
duration of the items in the list.  A SegmentTimeline can also be
inherited from the Period or AdaptationSet.  These have all been
added.  Also added SegmentList support for dynamic MPDs.

Closes #88

Change-Id: I849491b1c6a5808a58c597eccfd439154e2e6ecd
2015-08-03 16:54:28 +00:00
Jacob Trimble 950b17354c addExternalCaptions can now be called more than once.
Multiple calls to DashVideoSource.addExternalCaptions will each
add a caption source to the object.  Added unit and integration
tests for this.

Change-Id: I387d285b5d11aa345b3abefab05d633194863030
2015-07-30 14:55:35 -07:00
Timothy Drews 244871536a Export addExternalCaptions.
Change-Id: Iaf51aa032398d1fab72a990bf6b0094f4f2fb43e
2015-07-30 12:59:03 -07:00
Jacob Trimble 320a9ec9f5 Added addExternalCaptions method to DashVideoSource.
This allows an app to specify an external caption source so the captions
can come from a different source than the MPD.  The method should be
called before the call to load().

Closes #133

Change-Id: I0686fd800e0fe3a73d89a71e2f374dffef905dba
2015-07-28 16:57:36 -07:00
Timothy Drews 8880a8e378 Add more options for license request processing.
* Add a URL override and an HTTP method override to LicenseRequestInfo.
* Use LicenseRequestInfo objects as dictionaries so the pre-processor
  interface works like the Player.configure() interface.
* Ensure LicenseRequestInfo fields are valid after the pre-processor
  is called.
* Improve pre-processor integration test.
* Add @expose to some typedefs so they are included in the documentation.

Closes #134
Closes #135

Change-Id: Ia29d36d70fa661d58196d166cbc60b281c679594
2015-07-27 21:22:05 +00:00
Natalie Harris a88546f4d8 Update fast-forward and rewind to work with play/pause.
Closes #130.

Change-Id: I33ed2e2ac0014eb3b271f72904996d669b0f13ee
2015-07-24 14:21:16 -07:00
Natalie Harris 94f854afeb Better error messages for when persistent licenses are not supported.
Closes #85.

Change-Id: I5dab6aec18ff56332c42f1661db9057c6061afc7
2015-07-24 10:08:21 -07:00
Timothy Drews c8cf08f477 Add map getter functions that check types.
These may be used to sanity check arguments coming from outside
the library.

* Use new getter functions in Player.configure().
* Add additional tests for Player.configure().

Change-Id: Ib0b907cde46aeb65ca1273fb424e3f13872fa5da
2015-07-22 16:06:41 +00:00
Timothy Drews 38f70c5aeb Recover from failed segment requests.
* Reject Task Promise if one of its stages fails so that the caller's
  catch handler is invoked.
* Use TypedBind consistently in affected Promise chains.

Closes #131

Change-Id: I94fa6688949444212fa0b1edd3a94e0de4d6956f
2015-07-21 20:05:15 +00:00
Timothy Drews 810ebd104d Fix getStats() race.
A 'pause' event may occur before a 'playing' event (which is
different from a 'play' event).

Change-Id: Id332492b5f0de8631bacff586ca2f17804897a0e
2015-07-20 22:42:20 +00:00
Timothy Drews f08fbba66c Detect and recover from multiple buffered ranges.
There should never be multiple buffered ranges, but if there are
then at least try to keep playing.

Issue #121

Change-Id: I562bdb194dcc1f66701ad1b5bb3246b4e2fbe431
2015-07-20 18:20:37 +00:00
Timothy Drews 89d0ef505c Clear the buffer when switching audio streams.
* Add an optional parameter to Player.selectAudioTrack to clear
  the buffer like selectVideoTrack.

Closes #119

Change-Id: I40c4c1969115826890fe9719a988315b51e5b28c
2015-07-20 18:07:34 +00:00
Joey Parrish db01ebb53a Fix test failures caused by configure test
The configure test was setting the timeout to a very small number
and did not reset the config.

Ultimately, this should be fixed by reachitecting the settings to
avoid static variables so that settings are per-instance.

Bug introduced in issue #93
Phase one of issue #126

Change-Id: Icfae6cd425677929115878477eca26d9292d2dff
2015-07-15 16:27:48 +00:00
Timothy Drews ebb9aa6420 Parse 'group' attributes. Issue #67
Change-Id: Iaa07ff56c59e030270b52856d8822bea21a3aa6c
2015-07-14 20:19:56 +00:00
Joey Parrish f4d1eb2d70 Add text styling API
This API makes it easier to comply with FCC captioning rules.

Closes #115

Change-Id: I4c72fec56213d9c412b87a88ef88d30f05b02310
2015-07-14 19:28:16 +00:00
Joey Parrish 10f2d000b0 Fix compiler renaming of exported enum keys
Change-Id: Ie2bf29d1064bb4e29456a2c4feb29c29f480d17e
2015-07-14 19:28:06 +00:00
Joey Parrish f03a890fa6 Clear playback start time between playbacks
Closes #122

Change-Id: Ic36393df77c404bc958ab794af69b3cf0d5a8543
2015-07-14 12:10:03 -07:00
Joey Parrish 40e31e6ce5 Fix multiple init segment appends and switch race
The init data is only needed once after a switch.  It should be
removed afterward to avoid asking SBM to append it with every
segment.

This also fixes a race between switch and onUpdate_ in which rapid
switches can cause AdaptationEvents to be missed.

Change-Id: I32fd72c9fbe716c632b90ff2eb7ae3f6e628a1fb
2015-07-14 18:46:03 +00:00
Joey Parrish 6669cfbc12 Remove Promise workarounds
Now that google/closure-compiler#715 is fixed and we have upgraded to
a newer compiler, we can remove these casts.

b/21559591

Change-Id: I7769d95d7b440c648eb78e026d94544c640c41b4
2015-07-14 03:31:11 +00:00
Joey Parrish 0089fdb594 Update the Closure Compiler
* Update compiler to v20150609.
* Since v20150315:
  * Promise.prototype.catch externs now provided by compiler.
  * Iterator externs now provided by compiler.
  * Variadic function syntax has changed.
* Since v20150505:
  * BufferSource extern now provided by compiler.
* Since v20150609:
  * VideoPlaybackQuality extern now provided by compiler.

b/21559591

Change-Id: Ie7d030422e132879e28b1bdf538991a27ebc25df
2015-07-14 03:30:34 +00:00
Joey Parrish 9af15bc166 Fix typo
Change-Id: I2db2c9efbced8791cfdf22b6d1b311b4172a622f
2015-07-14 03:29:55 +00:00
Joey Parrish 328aa27c59 Fix type-inference issues with newer compilers
Newer versions of the Closure Compiler issue warnings for several
anonymous functions due to what appears to be a failure to infer
certain types.  This patch uses TypedBind to mollify the compiler.

This patch also fixes another issue raised by the newer compiler,
which is that index does not have duration and key_system properties.

b/21559591

Change-Id: Icff84ad084bfcd049f962bd4a0698b3fc78fc279
2015-07-13 13:56:16 -07:00
Joey Parrish c5f26f2013 Update VideoPlaybackQuality extern and polyfill
This updates the extern for VideoPlaybackQuality to match the externs
in newer versions of the Closure Compiler.

b/21559591

Change-Id: Id375f8722fa46f6779934e15930bd328310490d5
2015-07-13 20:56:06 +00:00