Commit Graph

53 Commits

Author SHA1 Message Date
Sandra Lokshina 8afadb4773 Add HLS objects and basic routines to parse manifests into them.
Issue #279.

Change-Id: I5b6f90b682d77849ce075a2a76a4202c56e5d882
2017-01-09 10:50:55 -08:00
Theodore Abshire 8b2212c65d Enabled asynchronous response filters.
Also updated externs.

Issue #610

Change-Id: I4c9539442d6fb77781296ea1acf123b3653e3b40
2017-01-09 17:34:22 +00:00
Theodore Abshire abca628239 Added support for asynchronous request filters.
Closes #610
Change-Id: I10d407d6c858f6541e869b834877a2ebbc516694
2017-01-05 15:49:49 -08:00
Joey Parrish 9dda7a9c73 Add placeholders for all retired error codes
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
2016-12-06 18:35:48 +00:00
Joey Parrish e6a6e980cb Throw explicit error on empty manifests
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
2016-12-05 15:16:46 -08:00
Joey Parrish 09d221de16 Update the Closure Compiler to v20161024
Change-Id: I6642b1e386667028c1adbcce97ab64b21a9104b9
2016-11-11 22:08:43 +00:00
Sandra Lokshina fade7d291d Fix handling of internal-error key status.
Closes #539.

Change-Id: I3ff30167034b4aed2bd390fc901e9466f6dd12c6
2016-10-06 20:14:24 +00:00
Sandra Lokshina addece6098 Log and ignore non-standard WebVTT settings instead of erroring out.
Closes #509

Change-Id: I1aced2ea8828c4ca6a9afee6ea28b0144a832029
2016-10-05 18:06:51 +00:00
Joey Parrish 3cad924cf1 In-progress recording (IPR) support, phase 2
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
2016-08-29 19:57:15 +00:00
Sandra Lokshina b069edae83 Create a new error code for 'internal-error' key status.
Closes #468

Change-Id: I5353e981e1831a300a1ef020668f013c334bba8a
2016-08-09 16:56:45 +00:00
Joey Parrish 56ebf6286c Drop WRONG_KEYS
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
2016-07-27 15:18:24 -07:00
Joey Parrish 1c4d7bbd85 Improve HDCP error handling
* 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
2016-07-25 16:33:08 -07:00
Sandra Lokshina 8b767df6a1 Implement parsing for WebVTT subtitles embedded in mp4.
Closes #277

Change-Id: If74bb81b66a78939b4f87e4f9f793328d50ed069
2016-07-18 23:52:56 +00:00
Sandra Lokshina 259777fe9f Implement parser for segmented TTML in MP4
Closes issue #278

Change-Id: I2f454a2c2f63d8ce6682cd4593c1d843b2967978
2016-07-13 21:49:43 +00:00
Joey Parrish 6daa7f3b83 Allow AbrManager to clear ahead of the playhead
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
2016-07-13 04:01:11 +00:00
Joey Parrish 0c8f74493c v2 Chromecast support
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
2016-07-06 11:47:04 -07:00
Joey Parrish d68e8dd27f Fix key status and session expiration in DrmEngine
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
2016-07-01 20:24:06 +00:00
Sandra Lokshina 2e86da6995 Add TTML XML parser plugin
This adds support for TTML in XML form only.  TTML embedded in MP4 will
be added later.

Issue #111

Change-Id: Ic44cbcc57c6105c398778e676565f2511bfd8a73
2016-06-28 16:48:21 +00:00
Jacob Trimble 6cc9613803 Add support for storing protected content offline.
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
2016-06-16 18:30:25 +00:00
Jacob Trimble 387ed49e92 Add offline storage manager and manifest parser.
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
2016-06-09 23:10:46 +00:00
Jacob Trimble 0530362b97 Add separate error for missing key system URI.
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
2016-06-03 00:11:41 +00:00
Timothy Drews fe9189e413 Allow Representations without Segment* elements.
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
2016-05-25 00:18:01 +00:00
Jacob Trimble c7c2b41ac9 Add DBEngine to manage IndexedDB connections.
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
2016-05-20 11:22:50 -07:00
Timothy Drews be09f52f03 Fix "parser" property & improve load/unload.
* 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
2016-05-15 06:17:50 +00:00
Timothy Drews ddbc13d4f8 Handle QuotaExceededError from appendBuffer().
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
2016-05-12 18:12:17 +00:00
Jacob Trimble e1d834f3c2 Add track restrictions to Player.
Now the application can restrict the kinds of tracks that the Player
will play.  This is done through player.configure().  This also
allows restricting the playable tracks based on the EME key status.

Closes #326
Closes #327

Change-Id: I88210ece6fd1db886c49d4599fbe5814d394132d
2016-04-15 12:21:24 -07:00
Timothy Drews d2a812cd98 Do not use drift when looking up segments.
* Instead of using drift when looking up segment positions,
  just fetch the segment before the one needed.
* Handle missing segments by polling instead of failing right away.

Closes #330

Change-Id: Ia7bb74d0120ee3ee965e351f87fc5f170ad585bd
2016-04-15 18:40:38 +00:00
Jacob Trimble 6ec2771aad Emit an error if the wrong keys are retrieved.
Now there will be an error if the wrong keys are retrieved from the
license server.  This can happen if the manifest is incorrect or if
the license server returns the wrong keys.

Closes #301

Change-Id: Id141cb74d02513f8e83205fd5d3242c887468d4e
2016-04-13 19:24:50 +00:00
Joey Parrish cb64d7646d Add response text to HTTP errors
Requested in #319

Change-Id: I2f52519d7a45769a0d2db3c038c9c04cf7fb59c1
2016-04-12 21:59:03 +00:00
Timothy Drews c0a6d7f238 Add additional compilation checks.
Adds additional compilation checks using Closure's
conformance framework.

Change-Id: Ifa868fc0379e5a8ef90cc36936d289f834f53625
2016-03-28 16:44:07 +00:00
Jacob Trimble e74f43bb94 Add clear key to ContentProtection key system list.
This also changes DrmEngine to reject key systems that do not have
any license servers, this causes init() to fail.

Change-Id: I10148c2caa2ffc57bf6c5f16421ed0600d98be95
2016-03-17 23:09:50 +00:00
Timothy Drews 415414154d Remove the receipt buffer from StreamingEngine.
The receipt buffer mechanism allowed us use byte-based
eviction; however, it increased the complexity of StreamingEngine
and required us to make strict assumptions about the manifest.

With the receipt buffer gone, we will now do time-based eviction.
Applications can specify a maximum "buffer tail" length instead of a
maximum byte limit.

Change-Id: Iafdbe2e71516ea0ae18254b9767ecfc1d6813644
2016-03-17 22:33:24 +00:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Joey Parrish f9008c7b0f Report extended errors from MS browsers
When the video element dispatches an error on MS and IE, there is
additional information that may be critical to diagnosing problems.

Change-Id: I5da621e414ea8c16a7240b2f64fb8555aef54588
2016-03-14 22:46:48 +00:00
Joey Parrish edc9bc8d49 Reject with Error objects in MediaSourceEngine
Instead of rejecting Promises with either exceptions or empty error
events, build full Error objects in MediaSourceEngine.

Change-Id: Ib4317f0ffe66c0292b3560f89f7a07e74e474dd3
2016-03-07 21:53:32 +00:00
Joey Parrish 55f9d6423f Add event dispatch to Player
Also improves shaka.util.Error docs.

Change-Id: I62080acfc4ff658eec1f4a72e36f4bac8c934267
2016-03-01 23:12:32 +00:00
Joey Parrish f02bff9018 Player.load, integration with streaming & DRM
This implements Player.load and integrates with StreamingEngine and
DrmEngine.

Change-Id: I28b80d835c3c07706bdd69059991e97390d590d8
2016-02-23 12:54:59 -08:00
Joey Parrish 282218a5c3 Spread out error codes
Each category now has its own range of 1000 error codes.  Using codes
in the thousands rather than the hundreds will help avoid confusion
between our error codes and HTTP error codes.

Change-Id: I8defd0ecbbbff7ef1b06e18419f29f16a85b2555
2016-02-22 16:23:40 -08:00
Jacob Trimble 49b238b3c9 Fix support for UTF-8 encoded data.
Before, we simply converted each byte from an ArrayBuffer into a
character; however, this is only valid for ASCII characters.  This
changes it to fully support UTF-8 encoded network responses.

Change-Id: I9c49f29b09960501d345b98aa7af1bb711972abf
2016-02-23 00:12:43 +00:00
Timothy Drews 77b3480c3a Introduce new StreamingEngine API.
* Replace onBufferNewPeriod() with onChooseStreams().
* Remove newPeriod()
* When transitioning Periods, only call onChooseStreams(p) once
  Period p has been setup.
* Refactor documentation.

Change-Id: Ic341dd018302bf46fdd071072e5facb0e0fccb3b
2016-02-18 16:47:12 -08:00
Timothy Drews a0c35403e5 Add StreamingEngine tests and fix several bugs.
* Tidy up unit tests, and add more eviction tests and drift tests.
* Add integration tests.
* Handle end-of-stream and end-of-Period scenarios when segments
  are not perfectly aligned to Period boundaries.
* Use segment receipts to determine which segment to buffer next.
* Handle drift with eviction and other drift corner cases.
* Handle additional errors and improve overall robustness.

Change-Id: Ib57a255cda7a6e8c5857eb82accc14697983b893
2016-02-13 01:57:09 +00:00
Joey Parrish 813b746160 DrmEngine and associated tests
This is mostly complete, but needs additional integration with an
as-yet-unwritten AbrManager.

Change-Id: I3836040c6891fb774be800b53679f49e365c7e1c
2016-02-12 16:06:31 -08:00
Jacob Trimble 8e21f46159 Fix ContentProtection parsing for non-IOP manifests.
This fixes the ContentProtection parsing to support non-IOP-compliant
manifests.  This enables the unit tests for it, as well as adding
several more.

b/26982075

Change-Id: I0da2dbaa24ea2a6acf657b97f0a2e2d24ee3a16d
2016-02-12 21:48:19 +00:00
Joey Parrish beb99ff8d4 Show error enum names in uncompiled mode
Change-Id: I69b1fc52c452ae4cc0647689a1a4c4863597b8e0
2016-02-12 18:16:56 +00:00
Joey Parrish 6d57a9181b Improve jasmine/karma formatting of util.Error
Add extra info to util.Error in non-compiled builds so that we have
meaningful stack traces in test failures.

Change-Id: I351d2f65ef764947f8318372a47eeb6f014d7b16
2016-02-09 14:44:59 -08:00
Timothy Drews f8b7b01fb0 Implement byte limits and segment eviction.
* StreamingEngine now limits buffers to a specified byte limit
  and evicts old segments as it appends new ones.

Change-Id: Id3e65bc45e782bf9d1214a6b52df0b92892606cb
2016-01-28 14:23:32 -08:00
Joey Parrish b822efcb86 Integrate Player with manifest parsers
Change-Id: I2388c8275a886709b35e7ec600fd6fa1340a6635
2016-01-16 05:10:48 +00:00
Joey Parrish 33c957298b Stringify Errors for better reporting in tests
This fixes unreadable test failures like "Failed: [object Object]"

Change-Id: I61d5abf273bd49f9b972c1a7adeab99e459f378d
2016-01-15 22:42:32 +00:00
Timothy Drews a4ff2711f2 Add StreamingEngine and Playhead.
Closes #101
Closes #186

Change-Id: I8d1a8d6c0f8cfb5abdd81a149318377282b2bea0
2016-01-15 14:30:27 -08:00
Jacob Trimble 54fa88f6f0 Added Dash manifest parser.
b/25851171

Change-Id: I4fbd6410d579899b749b50c8819fa8c17ac80658
2016-01-13 19:29:07 +00:00