Commit Graph

70 Commits

Author SHA1 Message Date
Joey Parrish 651b32a4ea Add detail to video errors in Chrome
This makes use of a new field added to Chrome 59.

Change-Id: I1b68e803967cfd7cfb64cea26458d0f3ef8a27c1
2017-06-20 16:49:59 -07:00
Joey Parrish 8fdd2921dc Fix offline storage offline in compiled mode
We were giving Storage a Player proxy from CastProxy instead of a
local Player instance.  This fixes the mistake and adds a new error
code to make it clear when this mistake is made by other apps.

Change-Id: I4f2d49adc45ef5ca3a942a72192a09f001f5100c
2017-06-05 18:03:32 +00:00
Theodore Abshire 723e6ad1bc Added basic xlink support.
This adds a utility to mpd_utils.js that filters a manifest and
automatically downloads and substitutes in the contents of any xlink
link.

This only supports xlink:actuate="onLoad"; "onRequest" would require
significant changes to our manifest processing pipeline.
It also adds a new field to INVALID_XML errors to indicate which
xml was invalid, to make the error more informative when called on
xml loaded by xlink links.

Also added a demo asset.
This is just a simple modification of heliocentrism to break it into
multiple files.

Closes #587

Change-Id: If87b1e78e65261dcc4e043b0c2e6cf69c1b12e08
2017-05-08 14:00:56 -07:00
Theodore Abshire a99ec6e378 Added a comment to warn about a Firefox bug.
Change-Id: I4a2a6f56c37d8223e5ba28ffaa04ae33334df7c1
2017-04-10 13:37:55 -07:00
Jacob Trimble 575f2ad109 Add an indicator for critical errors.
This adds a severity field to Error objects.  This can be used to
detect whether an error is recoverable.  All the same errors are still
reported so the field can be ignored.

There are two possible values:
* RECOVERABLE means that the Player will try to recover from the error
* CRITICAL means the Player will be unable to continue and must call
  load() again

Closes #564

Change-Id: Ie2c5468340c13e7a288b99690ab65b7ecc0a6b29
2017-04-04 23:57:59 +00:00
Joey Parrish db909b0f2e Add support for Widevine-encrypted HLS content
This abstracts the creation of DrmInfo to parse the EXT-X-KEY tag
differently per KEYFORMAT.

Issue #279

Change-Id: I2e187dcfc01f7306183c9090c54de58e81872bc4
2017-03-31 12:34:10 -07:00
Jacob Trimble 2cc68b2032 Allow switching between Periods with and without text
We don't allow switching between Periods that are video+audio to
video-only because it is incompatible with MSE.  When the browser
gets to the transition, it will pause waiting for the audio buffer.

However, we should allow switching between Periods that do and do not
have text streams.

Issue #715

Change-Id: I77f3bf92681d8181c90169b8f4a15857b7d9e66d
2017-03-09 21:07:59 +00:00
Chad Assareh 66b04259f0 Update docs to mention possible rMKSA rejection due to changes in Chrome m58.
Change-Id: Ic67adff5337ca21288cf66e3928fbd794234e99e
2017-03-06 15:00:27 -08:00
Chad Assareh 97cca1887b Return HTTP headers as part of the BAD_HTTP_STATUS error object.
Change-Id: I6b5a22b26fba8ace40f9cff00146e22b51c10041
2017-03-02 13:58:06 -08:00
Jacob Trimble 33c277ae82 Remove HLS requirement for init segment.
An init segment is not required for all streams, some streams are
self-initializing (e.g. MPEG2-TS).

Issue #279

Change-Id: I99556ee26f6568cc5e712b50d0bb4de78cb2bd9d
2017-02-17 11:21:13 -08:00
Theodore Abshire ad0b52eaaf Retired INVALID_TTML error.
There are some error cases where IE's implementation of DOMParser
will throw an exception, but Edge's implementation will return a
parsererror. This means that, in those cases, IE would result in and
INVALID_XML error and Edge would result in an INVALID_TTML error.
It's preferable for the errors to be consistent cross-browser, so
this folds the INVALID_TTML error into the INVALID_XML error.

Change-Id: Iee575ea22e8e803dd241b00e86f888668f4392c8
2017-02-14 18:20:15 +00:00
Theodore Abshire 56f6ef4394 Removed INVALID_XML_SPACE error.
The implementation of DOMParser on Internet Explorer and Edge actually
implement xml:space, which means that if you passed in an invalid value
the parser would error immediately.
Thus, on IE and Edge, an invalid xml:space value would return an
INVALID_XML error instead of an INVALID_XML_SPACE error.
Though clear errors are useful, such browser-dependent behavior would
just be confusing in the long run.

Change-Id: I46c24452a216fa8bc242148e23d275230f277037
2017-02-10 23:13:33 +00:00
Aaron Vaage 3db0f3357a Creating IStorageEngine Interface
To better support alternate storage mechanisms, this change abstracts
shaka.offline.DBEngine into an interface called
shaka.offline.IStorageEngine.

DBEngine has been changed to implement this interface, and allows the
addition of implementations that do not use IndexedDB.

Change-Id: I6a94067001ee53049df11cb68604bb57912300bb
2017-02-10 21:27:32 +00:00
Sandra Lokshina 24c17d2d44 Implement basic HLS manifest parser.
Issue #279.

Change-Id: Iec504a7f180f6f069d08bea471a7d4970f7ae7d4
2017-02-09 21:04:50 +00:00
Theodore Abshire 97b6c14db0 Adds support for xml:space in the Ttml parser.
Previously, we did not properly handle indentation in Ttml files, which
could result in the indentation of the XML elements showing up as part
of the subtitles. This adds support for xml:space settings, to
allow the maker of the manifest to enable or disable this behavior.

Closes #665

Change-Id: Iafee92a536ce6eb2d73c32186500715adb52e26b
2017-02-08 23:39:53 +00:00
Joey Parrish 8ba088a38f Generate externs automatically
We were not able to get our externs generated by the Closure compiler.
There were many issues with the Closure-generated externs, including
the order of the externs and the replacement of record types and enums
with their underlying types.

We made a few attempts to patch the compiler, but could not get our
patches accepted upstream.

This change introduces a new script to generate our externs from
scratch.  It uses a JavaScript parser called 'esprima'.

Some interfaces need to be exported to the generated externs, but are
not actually attached to the namespace by the compiler.  For this, we
introduce a new annotation.  These are the currently-supported export
annotations:

 - @export: truly exported (attached to namespace) by the compiler
 - @expose: truly exposed (not renamed) by the compiler
 - @exportDoc: considered part of the exports in the docs
 - @exportInterface: considered part of the exports in generated externs

These annotations are now documented in docs/design/export.md

Change-Id: I33bf7384889c14c9edb0fa5f11caa7c4f4d79af6
2017-02-01 11:42:16 -08:00
Jacob Trimble b445e46f75 Add error for duplicate Representation IDs.
See https://goo.gl/BAM3mi

Change-Id: Iea49b78ecd299e992b60f3776ec5360c15d2cb62
2017-01-30 21:06:24 +00:00
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