A bug in our Promise polyfill caused issues with the recently-added
AbortableOperation class on IE11. Since external polyfills for this
are smaller, it is easier to remove ours in favor of a third-party
polyfill. Applications that wish to support IE11 must now load this
additional polyfill.
We are using the "es6-promise-polyfill" module from npm, but any
compliant polyfill should suffice.
One feature our own polyfill offered was the ability to flush all
Promises, which allowed us to write synchronous unit tests that
simulated async processes. To get this ability back, we are now
using the "promise-mock" module in our tests.
Getting "promise-mock" to load correctly involved switching from
"requirejs" to "cajon", which builds on requirejs and supports
AMD modules more directly.
Closes#1260
Change-Id: I5de48e88a910736ae5c1897a7a509bc5641acb70
This adds OperationManager to HLS and DASH parsers to allow them to
abort and clean up network operations when stopped. We now re-enable
the player integration tests that were written to prove the previous
polling-based cancelation model.
Issue #829
Change-Id: Id09df6e3f2f40eef614d9e597d35f43a50e1673e
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
It is useful to have the default presentation delay configurable when the stream provider isn't able to add `suggestedPresentationDelay` in the manifest
Fixes#1234
When calculating segment references, the end time should be capped at
the period's end, except when the period has no end.
Closes#1204
Change-Id: Ia608452706bbc3fd847a645197e8a0cb57d7aaec
We were not previously applying presentationTimeOffset in
SegmentTemplate w/ the duration attribute. This fixes the DASH parser
to correctly apply the offset in this case.
This also fixes an issue in which segment times could stretch past the
end of the period or even past the end of the presentation, causing
StreamingEngine to fail period transitions afterward.
Closes#1164Closes#1163 (PR to address 1164)
Change-Id: Ib16fc2b65117557a4ad9a05adc4a07f8bc90fd3c
When shifting content using presentationTimeOffset, especially in
combination with SegmentBase and media segment indexes, there can
legitimately be segments which are outside the period bounds.
Instead of failing an assertion, throw out the unneeded segments.
This also drops some largely unnecessary and confusing warnings.
Issue #1098
Change-Id: I2addd6d45f1aaf95a1b981cd9373dd24163c13a9
According to the DASH spec, the timescale in the manifest need not match the
timescale in the media. Therefore, we should be applying scaled
presentationTimeOffsets in segment index parsers, since the two scales might
differ.
Issue #1098
Change-Id: Ic191d1bba399b30a656ab5060d7bb226e659b79a
If the parser is failing to load a manifest, perhaps due to being offline,
and the player is destroyed mid-load, it will wait for all of the retries to
run out before canceling. This causes a significant wait time on destroy.
This change adds an optional isCanceled callback to the request method in
NetworkingEngine, allowing requests to be made that can be canceled via a
provided callback. This is then used to quickly skip past all of the
retries, when destroying the parser.
This doesn't stop any backoff in progress, so there still might be a delay of
a second or two (depending on networking settings, of course) if you destroy
during a backoff period. That will be changed in a followup CL.
Issue #1084
Change-Id: I0b99616ed4d5be078161122532ea271e84613170
In DASH SegmentBase, we were not dividing presentationTimeOffset by
the timescale. In all other instances of presentationTimeOffset in
DASH, we were handling it correctly.
This bug was present in all v2 releases until now.
The solution is not only to divide by timescale, but to rename all
internal uses of presentationTimeOffset to either unscaled or scaled,
to differentiate between those in timescale units and those in
seconds. I believe inconsistent naming and units were a contributing
factor to the creation of the bug.
Closes#1099
Change-Id: Id561f8eb1f5bc011c606e1925c12f0d8183fd51a
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 #740Closes#1011
Change-Id: Ib3a59f87e3a050244cd39854409d8e3542c50b0a
HLS Live comes in two flavors: LIVE and EVENT.
EVENTs append segments to the end of the playlist, but do not
ever remove segments. LIVE can both append segments to the end
and remove segments from the beginning of the playlist.
This CL lays the ground for supporting both types and introduces
support for EVENTs.
Issue #740.
Change-Id: I2042660daf9d1e7209cb1b40f50ab8b24571faa4
This fixes a bug in which we did not track DASH period IDs during the
initial manifest parse, which led to duplication of all periods during
the first update.
Closes#963
Change-Id: Ife9be7e5f5e158a565b0095d7cbb81b50c681422
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.m3u8Closes#868.
Change-Id: Ied135b687190919abbeb1561c2bff36a7203136e
Although bandwidth is a required attribute in DASH and a bandwidth
value of 0 makes no sense, we can tolerate such content in many cases
and play it regardless. This used to work in v2.0.x, but stopped
working in v2.1.0 through v2.1.5.
Closes#938Closes#940
Change-Id: I0c9b8eba923971f00946282cd8c138f68827961f
This is part of adding a new conformance rule to add additional type
safety. This will disallow using properties of unknown types or using
unknown properties.
The first parts will be fixing errors caused by the new rule. These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.
Change-Id: Iefde089b2f62ddfdf43944cda5badab438577561
This fixes the detection of content type for text AdaptationSets which
contain mimeType only, but contain a Representation with codecs only.
Closes#875
Change-Id: Ibae7ae8357653c1960daefa4c3e122187de51bb3
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
At the moment, when there is an xlink problem, the manifest parser
returns a rejected promise. This adds a configuration variable to
instead simply not replace the xml tag.
Closes#788
Change-Id: Iace953233c83a57820130033150e7cd9a9385d6f
Before, if a relative xlink contained another relative xlink,
the nested xlink link would resolve its URI based on the filename
of the parent link, rather than its final URI.
Change-Id: Ic42ad8bfbd8487b4d1da66d86117823800c447be
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
A missing minimumUpdatePeriod should mean "do not update" or "only
update via emsg box". Internally, this is represented by -1.
A minimumUpdatePeriod of zero will be clamped to our internal limit,
which is 3 seconds.
This adds comments and new tests to cover these scenarios.
Change-Id: Ic1e74e0edf3a5f7bf5aed21c7740dbd33eab84ac
Different browsers implementations of DOMParser handle invalid XML in
different ways. In some cases, instead of the DOMParser erroring it
just inserts a <parsererror> element into the resulting xml tree.
This change detects if there was a typo deeper in the manifest, such
that the outer MPD tags are intact.
Change-Id: I9b11b0762d073b8e54129cddd5f3477039f2cb39
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
There were two instances of tests not cleaning up correctly. The
Dash Live tests didn't uninstall the Promise polyfill, which breaks
Promise.resolve for tests that don't expect it. Also, in the
CastReceiver tests, it defines a property on window. It needs to be
configurable, otherwise it cannot be set twice. Somehow the resulting
exception is not being caught by jasmine.
Change-Id: I0691a7bcddf14fd455f034d63e12fc8046044750
We usually fit segment references to the Period for VOD content. This
ensures that a gap in the manifest at the end of the Period doesn't
cause problems. We don't do this for live because we may get more
segments. However, for multi-Period live, we should still fit the
references for all Periods except the last one.
This also removes the error about duplicate Representation IDs for
VOD content since the problem only occurs for live.
Issue #694
b/35849085
Change-Id: Ib195dc51982ca58b8d5613b37817216980b8d366
Apple encoded content has a default time offset of 10 seconds.
Every other packeger we've encountered so far doesn't.
New config will default to 0 and allow the application to specify
the offset for their content according to the packager's standards.
Issue #279
Change-Id: I65b16b05a5974a2f0318cd1f9847c3a56c38b745
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
Before we would use the suggestedPresentationDelay attribute when we
determined the availability start, which is incorrect. This can be
seen by loading the DashIF live simulator streams and seeking to the
beginning of the seek range.
The DASH spec doesn't explicitly state this either way. It seems to
suggest that suggestedPresentationDelay is only used to synchronize
playback and isn't used to calculate segment times or availability.
The spec also says that clients can ignore the attribute and use their
own, which suggests that it shouldn't affect availability.
Change-Id: I44d23a556c1aa40c42e2893718f8da1d3a373e8d
There was a typo in the expected manifest in 'sets key IDs for the
init data'. I forgot a >. Honestly, I'm surprised the test passed on
Chrome. I guess the Chrome XML parser must be very permissive.
Change-Id: Ia272f2e629ad93db40e13cdb4b4001eb7ecf4f05
Adds a new field to initDataOverride, key Id, that contains the
default key Id corresponding to this initData. This is used to filter
initDatas by their key Ids, hopefully cutting down on unnecessary
license requests.
Closes#580
Change-Id: Ie228d6c0f4c693b19b4119ec4f72a85d555215c1
Now it is set in a more suitable stage of content parsing, thus
fixing a bug where the field would contain multiple copies of
every keyInfo.
Change-Id: I12875efa04c4e3ccbb459945091533006bd398fd
This also makes the Playhead ignore duplicate regions. This simplifies
manifest updates in DashParser by having it add every Event tag it
sees. The DASH spec doesn't specify how we should detect duplicate
entries or how events are fired. So to avoid firing all the same
'timelineregionadded' events on every manifest update and getting
multiple enter/exit events, we will simply remove duplicates.
Closes#462
Change-Id: If5d2c42bd6958567b2ec05ba1e9af252c95cf354
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
Rather than accepting multiple callback methods as separate arguments,
now start() will accept an object. This will allow us to add new
callbacks without breaking backwards compatibility or adding
additional arguments.
Change-Id: I839cbb12e71c2e7270aa218802c79440c458e964
Any EssentialProperty element we don't recognize is necessarily
attached to something we don't know how to handle correctly. We are
now following the recommendations in the specs which say that the
parent element should be skipped in these cases.
Change-Id: Iabd8a796c6c27e4187b3f0d7efe60ea35c933c7e
Parses DASH trick mode tracks and puts the extra trick mode Stream
into the manifest. StreamingEngine can now use this info to optimize
streaming during trick play mode.
Includes:
- a new demo asset with a trick mode track
- updates to tests (we now require at least one audio or video stream
and we require bandwidth attributes on them)
- updates to the parser's trickmode test
- a new StreamingEngine test
Closes#538
Change-Id: Id38264ca64bc7905a5c33a269269741cfd12dd4d
These properties are no longer used since we refactored for variants.
All compatible AdaptationSets are now implicitly squashed together.
Issue #279
Change-Id: Idc1922c54b0c1aa62f3199369b8e819e3a374b55
The DASH parser was not always correctly deducing the content type.
For unspecified content types, the type can be deduced from the MIME
type. For example, video/mp4 is video, and audio/webm is audio.
For text, things are a little more complicated. Text types do not
always start with text/. In particular, embedded text, such as VTT
in MP4, have a MIME type that starts with application/mp4.
To deal with that, if we see an unknown type, we ask TextEngine if it
supports it. If so, we deduce that the content type should be text.
This check against TextEngine was only happening for MIME types
specified on the Representation, but not on AdaptationSet. This
replaces a weaker deduction in the general frame parser with the same
TextEngine check we were using elsewhere.
Furthermore, Player mishandled the content types it passed to
AbrManager. AbrManager will only choose audio, video, and text
streams. It ignores all other types. Player, meanwhile, threw a
confusing error if AbrManager failed to choose some of the types
passed to it. Therefore, Player should only pass audio, video, and
text types to AbrManager.
This fixes both issues and adds new unit tests for both.
Closes#631
Change-Id: Ib1311d37d00c3989367fd066f66e1eba85652e40
We had a typo in the case of an attribute (schemeIdUri vs schemeIdURI)
and we did not have support for the latest scheme URI (upcoming MPEG
scheme URI vs /guidelines/ vs /descriptor/).
Change-Id: Ibee1802cfe2b04183d52e75378fa23e0c4e3aae8