Commit Graph

251 Commits

Author SHA1 Message Date
Joey Parrish 84a8d1ca18 Polyfill the HTML5 'input' event
The HTML5 'input' event does not work correctly on all input elements
in IE 11.  There are equivalent events that the UI can use on IE.

Instead of remembering this and checking for IE every time the 'input'
event is needed, let the polyfill translate the event type.

Change-Id: I23258a5c6a0bd37e946214380ad07949f3ee7f88
2017-07-12 12:29:14 -07:00
Sandra Lokshina b3586c193a Add stream bandwidth info to variant tracks.
Closes #834.

Change-Id: I3af66a227ad09f1686a7ca3f545c2bf9683d3c24
2017-07-07 10:20:54 -07:00
Jacob Trimble 310e48f8cc Fix rounding issues with multi-Period content.
Closes #882
Closes #909
Closes #911

Change-Id: Id31567137860b6bd683169b5b68ca83d6f14473d
2017-07-05 16:57:42 -07:00
Michelle Zhuo f09999aa80 Add channel count information for HLS audio tracks
Adding the count of channels, as a new field for tracks and streams.
Used for HLS audio tracks.

Resolves #826.

Change-Id: I1448b4a8cfaf6dd798670bb2f0f3981d6c7e40c3
2017-06-22 11:34:36 -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
Jacob Trimble 7a5991a01d Fix date parsing when timezone is missing.
In DASH, when parsing a date, it should default to UTC.  When we pass
the date string to Date.parse(), it will use the local timezone.  So
if we don't see a timezone, we need to manually add the UTC timezone
so Date.parse() will parse the correct timezone.

Closes #901

Change-Id: Ica0433042e9bfd42b0cbf62653bdbd2b97b56297
2017-06-20 12:43:23 -07:00
Michelle Zhuo 00b440f376 Support audio track selection by role and language
Exposing the roles of tracks, which come from the manifest, in the
select audio language method. This is a follow up on commit
b27861050c11451db57d87270ec1385c1906627a.

Closes #767.

Change-Id: Iebb873f1db8834c7275a8a9fc01c3b855c0288aa
2017-06-15 22:41:21 +00:00
Jacob Trimble 8835f7b898 Fix bug when trying to load when there are pending failures.
If you attempt to load an asset and then the first load fails, then
the second load will hang forever.  This was caused by the second load
trying to cancel the first, but the CancelableChain not handling this
case.

Closes #782

Change-Id: I79e201db44cbf47485e7221cc148bbfdde6276f7
2017-06-07 13:29:28 -07:00
Sandra Lokshina c6c6d05810 Move text-related files into their own directory.
This change creates a lib/text directory and moves all files
with text-related logic to it. It also lays the ground for
separating text parsing and display logic. (That change will
introduce even more files with text-related logic which will
crowd lib/media directory).

Issue #796.

Change-Id: I65ac134020a0126ff02a8f2067beb73870232e65
2017-06-06 18:21:09 +00: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
Joey Parrish 434f1bf9b0 Choose lowest bandwidth codecs
Before asking AbrManager to choose streams, we should choose codecs.
Choose the most efficient codecs, and do it after we have filtered
out the codecs that the platform cannot use.

Closes #841

Change-Id: Ifbdd22b33254d4584f77db6456ab238f7c04c755
2017-06-05 18:00:23 +00:00
Matias Russitto ace0e8cf49 add video and audio stream IDs for getStats().switchHistory (#846)
Closes #785, #823
2017-06-05 10:29:55 -07:00
Joey Parrish e8af210dab Clean up config merging, type check certs
- cleans up config merging now that abr.manager has been removed
   from the config
 - uses thing.constructor == Object instead of
   typeof(thing) == 'object', for better detection of anonymous
   objects
 - adds a default (empty) server certificate for type-checking
 - treats empty certs the same as null (no cert provided)

Fixes #784

Change-Id: Ie833a1b3bf484d5f12f3ebf6d513ed51740bdc44
2017-06-05 03:21:48 +00:00
Joey Parrish bb32073725 Fix PlayReady on IE and Edge
We broke PlayReady on IE and Edge in #815 when we fixed PlayReady for
Tizen.  This should work for both, but will still need to be tested on
Tizen after merging.

Closes #837

Change-Id: Iff41845ae6a4b369e8f21a80623ebb2cb5475fd6
2017-06-05 03:21:33 +00:00
iKinnrot bed012dc3c Add label attribute to text track (#831) 2017-05-31 13:54:57 -07:00
Michelle Zhuo afb0ded49c Expose Roles of Audio Tracks
This change is to expose an audio track's role in order to differentiate
among a main / caption / commentary track that shares the same
language.

Issue #767.

Change-Id: I05d38cba2170d0005611cf160b7ae45996fe77dd
2017-05-26 13:51:43 -07:00
iKinnrot 151930284a Add support for DASH label and HLS NAME attributes (#811)
* add support for non-standard DASH label attribute
* add support for HLS NAME attribute

Closes #825
2017-05-25 10:43:07 -07:00
Joey Parrish 494d6081fc Update Closure Compiler to v20170423
Change-Id: I28361a6c2d50087edc34695596731035a083543d
2017-05-16 17:19:27 +00:00
Joey Parrish eb92f14ab5 Add more missing exports
See also commit 7a770783.

This fixes exports and externs that were broken in v2.1.0 and v2.1.1.

Generated externs are now verified and working with an external
Closure project.

Change-Id: I73a6b92474c87fd6119592c6d632ce91045fc073
2017-05-12 14:54:41 -07:00
Joey Parrish 7a770783a8 Fix export of DataViewReader
DataViewReader is referenced in the exported class Mp4Parser, so it
must be exported as well.  This fixes broken exports and externs in
v2.1.0 and v2.1.1.

Change-Id: If94e623d36694dd528495f654bbb8f27d0b113ba
2017-05-12 14:24:50 -07:00
Joey Parrish f992851925 Don't recurse on serverCertificate in config merge
Treating serverCertificate as an Object and recursing causes an
exception the second time you set the serverCertificate config.

As a quick fix that can be cherry-picked for v2.1.x, do not recurse
on serverCertificate.  This has the side-effect of not type-checking
the serverCertificate field on input.

A more detailed fix will be made later, for inclusion in v2.2.

Issue #784

Change-Id: I84c05ee3dd370a4b83e9ce2337d2326ec36532c2
2017-05-08 23:46:38 +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
Michelle Zhuo b65cf1de81 Separate audio codec and video codec in Track
The audio and video codecs were combined in Track, so it's hard to
detect whether the track variant has video or audio track.
Changing the combined codec to two separate fields.

Closes #758.

Change-Id: I9fbd0b85830cac306dc09db2d71cf96f77146cbe
2017-05-05 17:32:20 +00:00
Jacob Trimble a42056904f Fix Player integration test flake.
First, by listening for the first 'timeupdate' event, we may run our
checks before the Player sees that we are playing.  Now we wait until
1 second in.  Second, there was some test contamination because of how
the timeouts were implemented.  If the tests took too long, then the
timeout for the first test would remove the listeners for the second
test, resulting in a test timeout.

b/36485220

Change-Id: Ia517cd5162cc4d8bf0aaf1b708c004c0b1145e0e
2017-04-20 17:45:36 +00:00
Jacob Trimble e5ce395f37 Implement gap jumping.
The bulk of the logic for gap jumping is handled in Playhead.  It
tracks the current buffered ranges and jumps over any gaps that appear.
It listens for a special browser event ('waiting') for when the video
element runs out of playable frames.

This change also removes the logic for jumping gaps at the beginning
of the timeline.  This is handled by the more general gap jumping
logic and works cross-browser.

Finally, this updates the buffering logic to only count the amount of
content buffered (i.e. ignoring the gaps).  This fixes some bugs where
gaps in the content can result in StreamingEngine buffering forever
since it thinks only a little is buffered.

This includes full implementation of the logic, but this doesn't close
the issue since there aren't any integration tests yet.  Those will
be added next.

Issue #555

Change-Id: Id99eb9fe469e8cf2c7464a3d70c3733791e806e0
2017-04-17 18:15:23 +00: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
Jacob Trimble d4d4347dd5 Add configurations for gap jumping.
This adds the new configuration options that will be used in gap
jumping.  This also changes Playhead to accept the config over the
rebuffing goal directly.

Issue #555

Change-Id: I467690ad1f417e69634087e04e0b44c98e1c9b81
2017-04-03 18:29:10 +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
Sandra Lokshina 01d6458422 Prepeare HLS parser for supporting encrypted content.
This change enables HLS parser to get DRM information
from the manifest and create DrmInfo objects.
Note that until we actually add support for any of the
drm systems, we will still reject encrypted content.

Issue #279.

Change-Id: I4d0652411a567bc75d919c5bf732f20e870a5aeb
2017-03-29 17:33:12 +00:00
Joey Parrish f9fc4adbe6 Add a utility to concatenate Uint8Arrays
Change-Id: I895939d3d15fdd2ba374e2abb587a1498df54538
2017-03-29 16:57:46 +00:00
Aaron Vaage ca87772a60 Define Mp4Box Using Strings
When defining a box, the box would be defined as a four
byte integer. Now there is a "fromString" function that
can be used to convert a four character assci string to
a four byte integer.

Change-Id: I78c704e012620c94ae681efb450977305bdb84aa
2017-03-22 23:13:24 +00:00
Aaron Vaage e50d01e03c Correcting Times for MP4 VTT Subtitles
Before the segment start time and end time were used to determine
the start and end time for all subtitles that appeared in the MDAT
box. The time values for each subtitle is specified in the TRUN box.

Now the time values are extracted from the TRUN box and mapped to
the correct subtitle in the MDAT box.

Closes: #699

Change-Id: I7179874aee7b617e994b136d17a082060ab1a0d2
2017-03-21 17:54:22 +00:00
Aaron Vaage 924e396a18 Added readInt32 to DataViewReader
Change-Id: Ib54b4997df19902c35ada8aaadbacba7292e2198
2017-03-20 12:50:55 -07:00
Aaron Vaage 175870fb4d MP4 Parser Refactoring
Before parsing Mp4Boxes was done using the "findBox" method. This
was limted to only looking at one level of the structure and
required a large amount of code to dig deeper into the structure.

This change creates a generalized Mp4 Box parser that should
simplify parsing Mp4Boxes. This will help work on #699.

Change-Id: Ie67ff30a6db890cae16fe02ae9c92bca711815a9
2017-03-16 22:46:19 +00:00
Sandra Lokshina cb11dac389 Fit segment references to the period length in HLS parser.
b/36070874
b/35849456

Change-Id: Ibd64b02dd98d2ff6db175412e5f44dc5e872d767
2017-03-14 10:32:41 -07:00
Joey Parrish 58d9156be2 Update default track selection for offline
By default, we will now store all text tracks, regardless preferences.
This not only helps with our demo, but makes sense for applications
that have not bothered to configure the track callback for offline
storage.

This also fixes bugs in the default track selection algorithm,
changes the default audio track selection to fall back on primary
variants in cases where the audio language preference cannot be met,
and adds tests for the default selection algorithm to verify correct
behavior.

Change-Id: Iead0499039e9ec596514aa7577265a7472914621
2017-03-10 00:51:28 +00:00
Jacob Trimble 5f8bc48ddd Choose an arbitrary language when none given
Before, we would select every variant when there was no preference
or primary tracks.  This meant that AbrManager could adapt between
different languages.  Instead, we should select an arbitrary language
initially so we only adapt within one language.

b/36094412

Change-Id: I4670a8bf02683fb78cfe572992c6268ed32e649d
2017-03-10 00:12:26 +00: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
Sandra Lokshina 0b12937520 Replace content type strings with constansts.
Change-Id: I4fda583915766b40ee7a5c7451d037077d9f2582
2017-03-08 21:41: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 fc46b29ed8 Move 'emsg' handling to StreamingEngine.
Rather than having it in the DashParser as a network response filter,
we should have it in StreamingEngine.  This will give it access to the
segment times so we can calculate the presentation times for the event.
Otherwise, there is no way to know when the event should actually occur
since the app can't know which segment is being downloaded or which it
came from.

This also adds startTime and endTime fields to the event so the app
doesn't have to calculate them.  For reverse compatibility, the old
fields will still exist.

Closes #698

Change-Id: Icbaf3619aedfca7ea06bc8b1fe49e9cce65b0cc2
2017-02-23 19:36:06 +00: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
Sandra Lokshina eff3225563 Add constants for shaka content types and stream kinds.
Change-Id: I6630863e3a53caf9c863e5df6a593cddba516f2a
2017-02-17 09:59:37 -08:00
Jacob Trimble fc5fe61bae Fix copyright headers.
We only use 2016 in the copyright headers for our files.  If we use
different years for different files, then the compiled library will
include copies of all of them, bloating the library.

Change-Id: Ia894601cbd660f9e7cbe84264b421ff60e847dcd
2017-02-15 23:36:45 +00: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