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
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
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
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
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
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
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
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
This abstracts the creation of DrmInfo to parse the EXT-X-KEY tag
differently per KEYFORMAT.
Issue #279
Change-Id: I2e187dcfc01f7306183c9090c54de58e81872bc4
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
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
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
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
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
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
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
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
An init segment is not required for all streams, some streams are
self-initializing (e.g. MPEG2-TS).
Issue #279
Change-Id: I99556ee26f6568cc5e712b50d0bb4de78cb2bd9d
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
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
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
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
Before, the Player would query StreamingEngine for the "active" streams.
The Player would use this to set the |track.active| field. However,
this causes problems with multi-Period content. Once StreamingEngine
has buffered through a Period transition, it will report the active
streams from the new Period. This will mean that in
|player.getVariantTracks|, none of the tracks will be active.
Now, Player will track the IDs of the active tracks for every Period
so it can correctly report which tracks are active.
Closes#680
Change-Id: Ib5ffc88b32e165f088e6472930eeb1b29b5adfe9
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
By exporting StringUtils and Uint8ArrayUtils, we can simplify the
process of wrapping, unwrapping, and parsing requests and responses
in NetworkingEngine filters.
This makes it easier to write filters that deal with text-based
data, as it is no longer the job of the application developer to
deal with subtle conversions between string and ArrayBuffer.
We will also fill in requests with defaults if needed. This allows
developers to omit fields when initiating extra requests at the
application level.
Closes#667
Change-Id: Ie6a0f23b4d46e7e458d996759eac6cd85a36b741
Before, we would fire a 'trackschanged' event when StreamingEngine
asked us to select streams for a new Period. However, this is not
when the tracks change, they change when the playhead moves into a
different Period.
This adds code to Playhead to track where the current Period is and
raise an event when it changes. This also reduces any extra events so
a 'trackschanged' event is only fired when the tracks actually change.
Issue #680
Change-Id: I85aedaed737f9324d5871201d952066886ea290c
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
Often we listen for an event once, then stop. This adds a convenience
method to EventManager for this increasingly common pattern.
Change-Id: I1507a904a8dac10b8d89965b3a0f192ed8f9ae2c
This add the groundwork for event regions that occur while playing.
When the playhead enters (or plays through) a specified region it will
fire enter/exit events for it. They are not fired when seeking over.
Issue #462
Change-Id: I9e280796bd012ad74d0319aa2056c6f6aa28890d
Both DASH and HLS parsers will be using resolveUris() and possibly
other methods in the future.
Create a ManifestParserUtil for the shared methods.
Issue #279.
Change-Id: Iaa5e32ec543a390341a54752563a9f27251f0832
Add UI options to select current audio and text language.
Split selectTrack() into selectText() and selectVariant().
Stop automatically disabling ABR manager when a variant is selected.
Add a warning if selectVariant() is called while abr is enabled.
Issue #412.
Issue #626.
Change-Id: I15f1c3c4fdc6d6b641f708fbef19dbcf10cbcfc6
This adds a second Restrictions object to the Player configuration to
restrict ABR decisions. The original restrictions will remove any
non-matching streams from the manifest, like before. This new
configuration will only apply to AbrManager choices. Any restricted
track can still be explicitly selected using Player.selectTrack.
Closes#565
Change-Id: I52379b096e81f97df22b6683669c5787694d87e7
During recent refactoring, we introduced a bug in which we would
filter out any text stream with a non-empty codecs parameter.
Replaces PR #639
Change-Id: I9a45ef7e1bc250fd989e3972c0670f3e48336511