Commit Graph

106 Commits

Author SHA1 Message Date
Jacob Trimble 76f78187b6 Add extended error code for failed license request
Issue #1689

Change-Id: I7d3b4eee487395fdb8c121a4b6acc11ec461f0e3
2018-11-28 23:27:51 +00:00
Jacob Trimble 9b885bac06 Give extra data for RESTRICTIONS_CANNOT_BE_MET.
Fixes #1368

Change-Id: I14563d309251c3ecd146fe6a467f30f637e4e6fc
2018-08-07 22:49:31 +00:00
Aaron Vaage 952c9b8341 Reject Promise In Player With Error
When reading through shaka.Player I found a promise that was being
rejected without an error. This change removes the log call and
rejects the promise with an error object.

Change-Id: I7072e2bb1ec367750ebb2dce31edff4e9c9e857b
2018-07-24 17:31:31 +00:00
Jacob Trimble 061aea1828 Add another entry for RESTRICTIONS_CANNOT_BE_MET.
Change-Id: I8bccecaa88c81581db524a6351c34a7a4750bfbe
2018-07-23 11:55:21 -07:00
Joey Parrish fd0449d8f7 Re-enable some disabled style rules
This re-enables the following style rules:
  - "block-spacing"
  - "brace-style"
  - "comma-dangle"
  - "comma-spacing"
  - "new-cap"
  - "no-multi-spaces"
  - "no-multiple-empty-lines"
  - "one-var"
  - "padded-blocks"
  - "prefer-rest-params"

Change-Id: I15d616e8d5b88b273ded6128b4f9ad86bdb26bd1
2018-07-09 19:44:56 +00:00
Jacob Trimble 759eef9685 Change goo.gl links to bit.ly.
https://goo.gl is being turned-down, so we can't use it for new URLS.
So we have consistent short links, this converts them to be
https://bit.ly.

Change-Id: I07a86cba807b67157664893341f648023918d0de
2018-06-22 20:20:00 +00:00
Sandra Lokshina 8163dd84b9 Work around (what we think is) a bug in mux.js which
prevents them from letting us know they're finished
transmuxing.

Issue #1449

Change-Id: Icfd4e16a29064783b57ef605228bfda4ca9bb169
2018-06-01 21:24:19 +00:00
Aaron Vaage 2a847e97f4 Removed Unused Error Code
Removed the error code for unsupported upgrade as we no longer support
upgrading offline content.

Change-Id: Ic4a6852acd7e7e18ce3038a771cc32d2d7806559
2018-05-10 16:20:45 -07:00
Michelle Zhuo 535de4db84 Refactor: Remove underscore from parameter names
Change-Id: Ie9e6fb59763f454f245175f23c6444f919ba8135
2018-05-08 19:21:51 +00:00
Aaron Vaage ef5c92c720 Added GetCell to StorageMuxer
Added a method to get a cell from storage muxer. Unlike resolve path
this will return a rejected promise if the cell can not be found.

Issue #1248

Change-Id: Ia594b7741351d515e564e574321e49ad51073005
2018-04-11 21:09:25 +00:00
Sandra Lokshina 8065bd54a8 Change namespace from shakaExterns to shaka.externs
Change-Id: I16432351e2a266aa8fd175669aa27c44bfdffeae
2018-04-11 17:26:26 +00:00
Theodore Abshire f32767578a Handle segment tags before playlist tags in HLS
Normally, we expect that only media playlists contain segment tags
(EXT-X-KEY, EXTINF, etc).  We determine if a playlist is a media
playlist by the presence of an appropriate playlist tag (EXT-X-MAP,
EXT-X-PLAYLIST-TYPE, etc).
However, we were checking tags one-by-one, on a single while loop.
This meant that we would reject manifests where a segment tag appears
before a playlist tag, as we did not yet know that the playlist was a
media playlist.

This changes the manifest text parser so that it checks for playlist
type first.

Issue #1382

Change-Id: I1b9f674a58c60ab291d6d004462b0c0cae49631d
2018-03-30 16:30:16 -07:00
Theodore Abshire 7c5186332b Typo fixes and rewording in comments, part 7
This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.

This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.

Change-Id: I225f5c7e54adf4cca8512cddae082ba50ed82e4e
2018-03-21 19:45:15 +00:00
Theodore Abshire f58afd21da Typo fixes and rewording in comments, part 5
This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.

This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.

Change-Id: Ibcaf21382bd78b91e589122983dd14e001bfdad5
2018-03-21 17:25:13 +00:00
Aaron Vaage 85bdf8ca23 Fix Errors in IndexedDB Code
Fixed an issue where an update call the IndexedDB was not replacing
the correct value because the key was getting changed to a string.

IndexedDB will count a missing key as a success, so check that the
value is undefined.

Issue: #1248
Change-Id: Icdd6ae263374c655170c6470df85c656b8bd3ba2
2018-03-14 00:06:04 +00:00
Joey Parrish 69ddb9537d Fix CONTENT_UNSUPPORTED_BY_BROWSER error code & docs
Issue #1349

Change-Id: Iea423c3192186d52acfe9990da2137fb0518a3fc
2018-03-09 09:36:45 -08:00
Joey Parrish b27ea82e7f Allow Player to attach/detach from video
This adds attach/detach methods to replace the media element in the
Player constructor.  Now applications can take back control of the
media element or provide a reference later in the Player's life cycle.

This also allows applications to decide whether or not to set up
MediaSource in advance, through an optional argument on attach and
unload.  The default will be to set up MediaSource in advance, which
maintains current behavior.  This advanced setup of MediaSource can
improve load latency later.

This change also introduces async/await for the first time in the
project, which required changes to eslint config, Closure build
arguments, Babel & Babel-polyfill setup, and the esprima parser used
by our extern generator.

The use of async/await will improve readability in many places, and
these infrastructure changes to enable async/await should also unblock
issues #1336 and #1337.

Closes #1087

Change-Id: I0d6b4e0e2af27a6520a3d070fa92b7139b2cb8b0
2018-03-06 22:19:53 +00:00
Aaron Vaage b92d8f31e7 IndexedDB Storage Cell for IDB Version 2 and 3
Since the database schemes for idb versions 2 and 3 used the same
data types (shaka offline version 2) this storage cell can be used
for both. The only difference is that idb version 2 has a fixed
key space.

Issue: #1248

Change-Id: Iac5cb1d57f93fdb81729b59d67d6736e29c9968c
2018-03-06 21:47:37 +00:00
Chris Fillmore 3494c2e137 Update docs for 6014 EXPIRED (#1324)
Closes #1319
2018-02-27 13:48:35 -08:00
Jacob Trimble 624acc66b8 Add curly braces to all blocks.
Google style guide requires adding curly braces to all block statements
even if it is only has one line.  This fixes it by using eslint's
--fix flag followed by running clang-format to reformat the change.

Change-Id: Idc086c2aa8c02df5ef8b2140a11bfb9128eeb4bd
2018-02-21 11:23:34 -08:00
Jacob Trimble f70436540c Convert 'var' to 'let'/'const' (3 of 9).
This is part of a change to convert all usages of 'var' with either
'let' or 'const'.  This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.

Change-Id: I10f5c38a8b06b5797c6eec7492829084114514c9
2018-02-14 00:47:03 +00:00
Chris Fillmore 4ac1a40578 Provide RequestType in error data from HttpPlugin. (#1254)
Closes #1253
2018-02-12 10:01:58 -08:00
Theodore Abshire 35d8838ed3 Change null body to undefined in Fetch
Fetch requests with a method of GET or HEADER cannot have a body, or
else the request will fail. Normally we had no problems with this, but
it turns out that Edge counts a body of 'null' as being defined.
This changes the Fetch scheme plugin so that it will replace null with
undefined for the body in the init data.

This also makes it so that HTTP_ERROR errors emitted by the http
plugin will include the original error, to aid in debugging future
issues.

Change-Id: I0531656dada25f97ef610d4285c225d57d7ef262
2018-02-09 22:21:27 +00:00
Joey Parrish d4b1eb0ca6 Handle UNSUPPORTED_UPGRADE_REQUEST in the demo app
Issue #1230
Issue #1248

Change-Id: Ia3942d8f6fc1b6c5e0166f86aa6620625f75d0db
2018-02-01 08:36:05 -08:00
Joey Parrish ed54199260 Upgrade and unfork jsdoc
This updates jsdoc to the latest version from npm and forks a copy of
the default jsdoc template.

In subsequent commits, we will reapply our customizations to the
template and to a jsdoc plugin.

This also fixes several bad annotations that the new jsdoc failed to
parse.

Issue #1259

Change-Id: I00a47270ea4754e1c96c43ca900d5cf889ab72e6
2018-01-31 22:04:48 +00:00
Joey Parrish 2f55d2a3bd Use AbortableOperation in networking
This uses AbortableOperation in all networking, from the scheme
plugins all the way to the request interface.

This also updates all default scheme plugins, docs, and sample code.

Backward compatibility is provided for scheme plugins and the
request API in NetworkingEngine.  This compatibility will be
removed in v2.5.

Two cancelation-related tests have been disabled in
player_integration until the new abort interface has been adopted
in the manifest parsers.

Issue #829

Change-Id: I91c8e6efe97798d111e8ddca5655cddc1f6bcbf3
2018-01-29 19:23:47 +00:00
Joey Parrish e5afb35169 AbortableOperation interface
This adds a general interface for abortable operations, and a specific
implementation of that interface for use internally.  This should
simplify the transition to abortable network requests and others.

Issue #829

Change-Id: Icf54e23028f7454640f5ec76ca97d8a8ed5915ed
2018-01-29 19:23:47 +00:00
Aaron Vaage 14e6b3a230 Create Upgrade Pattern
Create the pattern for how to handle database upgrades. As of this
change the only upgrade supported is from version 0 (no database).

Issue #1047

Change-Id: I9f889a9e39a190e926cf06f0720a5371bc3c59af
2017-12-14 14:53:48 -08:00
Joey Parrish 2e5b856f79 Do not require EXT-X-MEDIA-SEQUENCE in HLS live
Closes #1189

Change-Id: Iae6f4f4524bb9895f8b211491793cf7626661a5d
2017-12-13 18:49:03 +00:00
Joey Parrish a18dc01874 Remove broken HLS time offset code
We misinterpretted the EXT-X-START tag before.  Now, we ignore this
tag and parse segment times from the segments themselves.  This is
more robust for both VOD and live HLS content.

We avoid segment parsing when updating normal, well-behaved live
streams.  For poorly-behaved live streams, we will fall back to
segment parsing and recover.

This also addresses the issue of VOD content which does not start at
zero.  Instead of using configuration to make this playable, we will
now offset VOD content back to 0 automatically.

Issue #740
Closes #1011

Change-Id: Ib3a59f87e3a050244cd39854409d8e3542c50b0a
2017-10-30 18:51:29 +00:00
Sandra Lokshina 113d9744a7 Add support for HLS playlists with type LIVE
Issue #740

Change-Id: Ia3dcdd29d8b85f5f1b266455d70a6cafbdc94757
2017-10-24 23:58:37 +00:00
Jacob Trimble 1224464535 Use goog.DEBUG over COMPILED.
This allows including the extra assertions and logging in the debug
compiled library.

Change-Id: Ie8575a31b428e1985077939169bfae9254e395d5
2017-09-27 11:24:32 -07:00
Tim Plummer 775d755259 Remove deprecated @expose annotations.
Added externs for error.js and removed the @expose declarations from the
actual error.js file. Updated the jscompiler flags and docs.

Change-Id: I2aa95ef1c82fc7bd349c637cca3141d5a003b646
2017-09-26 13:51:36 -07:00
Joey Parrish 2af0de2adb Move streaming retry logic into callback
Closes #960

Change-Id: Ieeacbf2e25f53a5af25a1de1935085e43457a092
2017-08-10 20:27:53 +00:00
Sandra Lokshina 5f0a830c36 Reject HLS live content until we have support for it.
Change-Id: I57842758cf62ec05df0c552886b8a80d2c15b38e
2017-08-07 22:06:57 +00:00
Michelle Zhuo d67764b5ff New Error Code for Content unsupported by Browser
Previously "UNPLAYABLE_PERIOD" exception is thrown when a browser
doesn't support the container or codecs in a piece of content, which is
confusing to developers and customers.
Changing it to "CONTENT_NOT_SUPPORTED_BY_BROWSER" exception.

Test manifest:
https://media-ci.foxford.ru/dist/hls-issue/issue.master.m3u8

Closes #868.

Change-Id: Ied135b687190919abbeb1561c2bff36a7203136e
2017-08-04 11:07:07 -07:00
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