Commit Graph

23 Commits

Author SHA1 Message Date
Michelle Zhuo d221339326 Remove empty lines in response header
Since IE/Edge returns the header with a leading new line('\n'), we need
to remove it from the response.

Closes #1172.

Change-Id: I133f9cfbada6486edc438f3dcbc37c7c78dbf36c
2017-12-12 18:03:01 +00:00
theodab fefe93480d Allowed multiple plugins for one scheme
This modified the networking engine to store every plugin it is given
for a scheme, and adds a priority system to pick which of the plugins
to use.

Issue #829

Change-Id: I21a8a534383f2be898160d609d77efecfc2b684b
2017-11-03 22:38:55 +00:00
Jacob Trimble 6069e76c4e Disallow ArrayBuffer.slice.
ArrayBuffer.slice isn't supported with two arguments on Tizen 2016.
This is a temporary fix that can be cherry-picked to v2.2.  A better
fix will be handled in a follow-up change.

Issue #1022

Change-Id: Iae6a0b2ef0cf17843f42f22f0ea0962a56e8be68
2017-09-25 17:28:19 +00:00
Jacob Trimble b5cbc01088 Don't retry for 401/403 HTTP codes.
Closes #620

Change-Id: I1df99cca6bb6a704b6ff055399298914d6e91e8f
2017-04-05 21:35:24 +00: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
Jacob Trimble 40bd34d8ac Add support for special cache header.
This allows network responses to have an X-Shaka-From-Cache header to
indicate that the response was somehow from a cache and should be
ignored for bandwidth calculations.  For example, this can be from a
service worker intercepting the request.

Change-Id: I4dfdf4211921b7205febb58f1e80967f0c4841cd
2017-03-03 19:53:17 +00: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
Theodore Abshire 07c564b4a2 The http plugin now fails on 202 status codes.
Closes #645

Change-Id: Ie20d1de1e8eff30d7656886e2b85d0e39079774a
2017-01-06 21:37:59 +00:00
Joey Parrish 18da8e04dc Export all plugins
This exports all plugins from the library, to make delegating and
subclassing easier for applications.

This also fixes a couple of issues with the generated documentation.

Closes #551

Change-Id: I23798f6117e1944d7ffc67bcb50ae36f3943710a
2016-11-14 23:58:09 +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
Joey Parrish e70461221f Fix jsdoc output of non-constructor plugins
jsdoc was getting confused and generating, for example, a file called
"shaka.media.html#VttTextParser".  Moving the @namespace annotation to
the method itself fixes it.

Change-Id: If26cac698b19d1305c270e519b7ed50ed81492fe
2016-04-06 16:52:06 +00:00
Joey Parrish 32e351d060 Add @namespace annotations to static classes
Without @namespace annotations, static classes do not show up in the
generated API docs.  Although I stumbled over one instance while
writing tutorials, the rest were discovered programmatically by:

for x in $(find lib/ -name '*.js'); do
  grep -Eq '@(constructor|interface|namespace)' $x || echo $x
done

Change-Id: I97dd2bb4bf3faad5ac8d952a28837fa1f594deb9
2016-04-01 11:37:41 -07:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Jacob Trimble 8daf53e329 Renamed shaka.asserts to goog.asserts.
Using goog.asserts will work with the compiler.  So rather than
simply casting a nullable value when passing to a method, we can use
an assert which will correct the type and print a log if it somehow
is null.

This is not the same goog.asserts found in closure library, this
simply calls console.assert, but it is not required to do anything
for the compiler help.

Change-Id: I2548e39e772f0aa7ec41437cf9f5a2be383e0fbd
2016-03-11 15:29:20 -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
Joey Parrish 454662817b Remove unnecessary defaults in HttpPlugin
Change-Id: Ib146e46980dd5e10ed437be09d6360481335f149
2016-02-19 22:20:51 +00:00
Joey Parrish 5c4240e358 Add debug logs for HTTP error text
This was useful when debugging license request failures.

Change-Id: Icb8f56fa02fe52f0d01c3c353fdb6ee0fa3f751d
2016-02-19 19:18:51 +00:00
Joey Parrish 0b886325ab All response headers should be lowercase
This makes it possible for the few parts of the code which will use
headers to do so without relying on assumptions about case.

Change-Id: I3b1ca57a3d789d18d51b4ee94f0791daf301993f
2016-01-15 15:12:21 -08:00
Joey Parrish 075af4ed4b Detect HTTP 302 redirects
When possible, use xhr.responseURL to detect 302 redirects and make
the information available in the Response object.

Use redirect URI as BaseURL for manifest parsing.

See also #225, #266

Change-Id: Ie24abeb3b8418b3e89fed6666eb525aecd74f03b
2016-01-13 17:20:51 -08:00
Joey Parrish 3bb8f06b7d Require assertion messages
This will enforce messages on assertions, which should make console
logs more useful.

Change-Id: I2cff9e20f630d1d4d46192e2ee317b1942cc7188
2016-01-08 13:29:56 -08:00
Joey Parrish f2ca3a5b53 Move externally-used record types to externs
This is important to avoid renaming properties during compilation so
that applications can inject these types without compiling their code.

This also migrates record typedefs to the new documentation format.
Each record will be annotated with 'property' for each field in the
record.  This results in better output from jsdoc.

Change-Id: Ia877b1e2b333ef7020a85f16bc2469a20879bf94
2016-01-06 12:10:47 -08:00
Joey Parrish c934f426d8 Add new error type
This error type will be used for all internal errors, and will rely
on numeric error codes which can be easily checked by the application.

This also changes PSSH parsing to throw on errors instead of retaining
partial data.

Issue #201
b/25306826

Change-Id: I19d23d99d4ee72cb31fe5f233bac57a3a9cfc283
2015-12-04 10:26:08 -08:00
Jacob Trimble 24eaf05fbc Added network plugin for HTTP and data URIs.
b/25296248

Change-Id: Iaea524f00e2297e151dc2fe93243083ce8b9949d
2015-11-25 12:14:05 -08:00