Changed download manager to take |shakaExtern.Request| as input
instead of |shaka.media.SegmentReference| and |shaka.media.InitSegmentReference|
as it really does not need to know about those types.
Issue #1248
Change-Id: I797c437f4339cf670b5eddad14952b0526b72ea5
According to @beaufortfrancois, we should no longer be using protocol-
relative URIs. He quotes this passage from Paul Irish:
> Now that SSL is encouraged for everyone and doesn’t have performance
> concerns, this technique is now an anti-pattern. If the asset you
> need is available on SSL, then always use the https:// asset.
> Allowing the snippet to request over HTTP opens the door for attacks
> like the recent Github Man-on-the-side attack. It’s always safe to
> request HTTPS assets even if your site is on HTTP, however the
> reverse is not true.
Source: https://www.paulirish.com/2010/the-protocol-relative-url/
This change was begun with the following command:
git grep -l "'//" | xargs sed -i "s@'//@'https://@g"
Some changes made by that command were false-positives, which I then
reverted manually. Others required additional cleanup to meet style
rules.
I've also just discovered that the "max-len" rule in eslint's Google
style config exempts URIs, so there's no need to disable the max-len
rule on URIs in the assets list. These have been removed in the asset
list where unnecessary.
Finally, testing these updated URIs led to the discovery that two of
our third-party demo assets are no longer available. One URI needed
to be updated. The other had no obvious replacement, so it was
removed.
Closes#1390
Change-Id: I2fe23faec04f1904c1741236b364d5089900092a
Added a preferred audio channel count to configuration, default set
to 2.
Choose the codec with the largest number of audio channels less than
or equal to the configured number of output channels. If this is not
possible, choose the smallest number of channels.
Closes#1013.
Issue #1071.
Change-Id: I6c6a956e33637cf34bd4bd79af563dc10a595e94
To make it easier to understand, we collect all the streams within a
period using a map. This ensures that we will have a set of streams.
We then download each stream in the map. Since the map is indexed by
stream id, we can easily connect the variants and streams.
Issue #1248
Change-Id: I65ae01733b5d9dbf8b6d73c37f802320fffa03d1
ABR should not select key-system restricted tracks since we can't play
them. Rather than updating AbrManager to do it, the Player should
just filter out the restricted tracks so a custom AbrManager doesn't
need to worry about it.
Change-Id: I5fa5cdcd9a035136fdccf9bee1a54752a0cacf1f
Made some changes in how the unit tests were structured so
that it will be easier to identify problems with changes to
storage.
Issue #1248
Change-Id: I8331f18e9c9e360cf8057737ddfd71c7152a744b
On some platforms, the sample used in that test leads to a
buffer start time of 1.4; on other platforms, it leads
to a buffer start time of 1.4667333333333332.
Perhaps this is a result of the implementation-specific rounding
differences in different mediaSource implementations, or perhaps there
us a very small gap in the content that some platforms handle slightly
differently.
Either way, this change loosens the tolerance on the check. That buffer
start time check wasn't the important part of the test, anyway.
Fixes: 77471871
Change-Id: I866fafe671566cc7116e7c99222f75225cffd476
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
Our support for CEA 708 closed captions only works if the container
video file is transmuxed. Because of that, we were not successfully
reading such captions on platforms with native TS support.
This change adds a configuration option to force TS to be transmuxed
even when unnecessary, to account for that situation.
It also adds an integration test to ensure that CEA 708 captions can
be extracted on every platform.
Closes#276
Change-Id: Id8b2a67f2327d1b69c9cdfc443e9592c99baf0db
For slow embedded devices, such as the v1 Chromecast, updating the
DASH manifest takes far too long. The result is that we can sometimes
repeatedly fall out of the seek range when playing near the left edge
of a live stream.
Until we can dig into and optimize the DASH parser, we will detect
and adapt to slow parsing by updating the manifest less often.
This is done based on how long updating actually takes, and does not
hard-code either the platforms that need this workaround, nor the
frequency of updates they can handle.
Bug: 75276747
Change-Id: I6565192b4ce6935ee8416ea4843fee851f4bd990
This fixes a weird edge case where StreamingEngine could get stuck
waiting for Playhead.
If StreamingEngine is playing close to the left edge of a live stream,
a manifest update can evict segments it needs. This causes
StreamingEngine to wait for segment references. This condition won't,
change, though, until Playhead seeks back into the seek range.
Playhead wouldn't seek back into the seek range until video.seeking
became false, which couldn't happen until StreamingEngine appended
some content that intersected with video.currentTime.
There seems to be no good reason for Playhead to care about the
video.seeking.
This resolves a startup failure while trying to play live streams at
the left edge of the seek range on slow embedded devices such as the
v1 Chromecast.
Bug: 75276747
Change-Id: Iaa084e8220ace174909d3ad91abe0c1eac00cea9
This test has been flakey on OSX for quite a while, but it was very
occasional, and the likely cause of the flake is unrelated to the test
itself, so it was never really dealt with.
Recently, though, the test has been failing repeatedly on the BuildBot.
This change quarantines the test so that the BuildBot will stop failing.
Issue #1215
Change-Id: I1a721976c277cfb9324b0b3f9cf8eae49b17d1ca
No one media type will be streamed far ahead of any other. The limit
will be the max duration of one segment.
Bug: 75276747 (mitigates)
Closes#964
Change-Id: I0f118e73912b46c987e58d4a5c123acf8412be0b
Adding "mechanism" and "cell" fields to offline uri. But since
they are not used anywhere, this change sets them to dummy values
so that all the constructors could be updated.
Moved the manifest reconstruction code into a instance class as
the mechanism and cell for the asset is needed in order to create
all the segment uris.
Change-Id: I2b5738805b17c4aa33d39b3166fddf1528aed489
Previously, we would read each individual VTTC and VTTE box in the
MDAT and associate them with durations in the TRUN. This worked for a
lot of content, but if sampleSize is defined in the TRUN, a duration
might refer to multiple VTTC boxes.
This changes the VTT in mp4 reader to parse the MDAT based on the TRUN,
to account for such situations.
For the moment, this only accounts for a single MDAT, and assumes that
the MDAT contains nothing but vttc or vtte boxes, listed in order.
Issue #1266
Change-Id: I56e310d085abdda16e968761ed3b4fd0cc5e24d0
This fixes how we determine the seek window for live content. This
also allows for a slight margin for small seek windows in reposition_
so we don't repeatedly seek with that.
Closes#1331
Change-Id: I70e5e7c134677350d89d42cb0b5abfa784061b9e
The only time we ever need to update a manifest value is when
we update the expiration time. To make it easier to support
updating expiration time across different version, only allow
that one value to be updated.
Change-Id: I621ec744019802edc65b059baa7f5cf0c476b0b1
The offline uri is going to soon contain more information (routing
information used by the storage muxer) so this change makes offline
uri a class so that all components can be accessed.
Change-Id: I5137f278e0dab059191d450876cab42745e4ed0b
Fixing the seek after load not working issue where our customer wants to
start the video from a certain time when playback.
Deleted earlySeekTimer.
Closes#1298.
Change-Id: Ifa293c20c1baf76193948e3b5a7778a2f262222e
Made a copy of the storage cell tests for indexeddb but made them
work for the memory storage cell so show that we can expect the
same behavior from them.
This is to give us an extra level of confidence when we use the
memory storage cells in place of the indexeddb storage cells in
our tests.
Issue: #1248
Change-Id: I96eaf57a9d808b4c7e07f97ac2713318a889fc24
This unblocks conversion of tests to async. We ran into issues in
compiler version v20171203 which have already been fixed upstream.
We are not, however, updating the linter. The matching linter version
reports errors about our tests not using goog.require, which we do on
purpose. We will wait to update the linter until we have resolved
that.
This change also fixes issues discovered by the upgraded compiler:
1. Missing property definition in playhead_unit
2. Wrong type name in storage_unit
3. Wrong type name in FakeManifestParser
Change-Id: I4ba3f43e6a6471e182a69c85cfc619de3380c559
This breaks Player.load into a number of async sub-methods, which are
called using await.
This should improve readability, and make load somewhat less
intimidating.
This also removes cancelable chain, which after the refactor is no
longer used anywhere in the codebase.
Closes#1336
Change-Id: I85ad22b9c8c6b7f72b27471ddd762763e6591a71
To allow playing live stream from certain offset from live edge, we
allow setting the value of opt_startTime parameter for player's load()
function.
Closes#1178.
Change-Id: I23a2375ba8ee5946791ee79714ed017c4e677c9a
When there is a zero-width seek range, don't repeatedly try to
reposition the playhead to keep within that range. This simply adds a
small buffer around zero-width seek ranges.
Closes#1331
Change-Id: I87b787f1454750eaa2caafa7c23cb9e37d3328e6
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
Our HLS parser made init segment references for everything but text
streams. This condition was unnecessary, and the
createInitSegmentReference_ method already returns null if there is
no init segment specified in the playlist.
Closes#1270
Change-Id: Ia9e92a561dc0f9ee3caccfac30f3fb936d9dac87
This turned out to be three issues layered on top of one another:
First, we would fire the "streaming" event too early, before our final
stage of filtering. This meant that for multicodec content, you might
be selecting a track which will be subsequently filtered out. If the
track was no longer available after filtering, we would effectively
ignore your selection. This bug would only be triggered by multicodec
content (VP9 & H.264, for example).
This change fixes the ordering so that filtering comes before the
"streaming" event is fired. A unit regression test was added.
Second, there was a code path in which we could ignore your track
selection. This was very easy to trigger with the "streaming" event,
and in an uncompiled build, would result in a failed assertion.
This change corrects assumptions about when we can ignore deferred
switches in the Player. We had not previously accounted for the case
where we were still setting up the first period, which is easy to
trigger with the "streaming" event. An integration regression test
was added.
Third, once the second bug was fixed, we could fail some assertions in
StreamingEngine and still effectively ignore your track selection.
This is because we did not reset a flag in the Player that tracks the
StreamingEngine setup state and informs when we defer switches.
This change resets the flag when we tear down streaming. An
integration regression test was added.
Closes#1119
Change-Id: I16be372cfaf4d592ca895e41ad04333bc0b2eeee
The new release has a new parameter in runAll() which simplifies
flush().
At this point, we could technically do away with our flush() method
and call runAll(false) directly, but I find flush() more clearly
indicates to the reader what we are doing.
Change-Id: I90f105ff38d032e3c9caf5484d78824dc64fe43d
This fixes both IE ended states in the demo controls and in streaming.
If StreamingEngine increases the duration of PresentationTimeline to
match MediaSource's duration, this can cause buffering at the end of
a replay by inhibiting a call to endOfStream().
Closes#979
Change-Id: I6770edb69597198dee3ae1b96df31756bbf4b391
- Translate uncaught Promise rejections into test failures
(Chrome only until the event is more widely implemented)
- Clean up uncaught Promise rejection caused by exceptions thrown
after destroy() in:
- CastProxy
- CastReceiver
- NetworkingEngine
- StreamingEngine
- Clean up uncaught Promise rejection caused by test cases in:
- CancelableChain unit tests
- DrmEngine unit tests
- StreamingEngine unit and integration tests
- Player unit and integration tests
- Speed up rejection in NetworkingEngine when we should not retry
- Add --delay-tests to test.py, to aid in debugging uncaught
Promise rejections and other types of async test pollution
Closes#1323
Change-Id: I5a8f5702a22430929babeb071bf6650c52c5ad17
Catch BAD_HTTP_STATUS error thrown by makeResponse in xhr.onload
Also wrap mock XHR event handlers in try-catch blocks in
http_plugin_unit to avoid regression.
Resolves#1302
The Transport Stream assets (Art of Motion(HLS,TS) and Sintel(HLS,TS,4k))
were disabled in the demo app, because the assets were only filtered by
native platform support.
Closes#1214.
Change-Id: I03b60df291813b4669889fc8f8500627d206b28a
We've been asked to implement this to allow for a custom app
behavior where app exposes all the tracks independent of language
and role.
In that scenario changing audio language will affect current text
track and the other way around. This CL makes sure it doesn't.
Closes#1299.
Change-Id: I39a9748c033ea748173ca00bfa7168dff642a03e
This is an automated fix to be inline with Google style guides, this
was created with eslint's --fix option.
Change-Id: I860eecbc8152603e730aa17a1393f16d26b3b6fc
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
The browser should handle extremely small gaps for us. So having the
browser handle these gaps, this avoids an infinite loop if there are
rounding errors.
Closes#1309
Change-Id: I365f44185f570571f6b093bdcaad92fef49b5b16
Rather than using the availability window, Playhead should use the
seek range to restrict the playhead's position.
Closes#1224
Change-Id: I8612bfafb53bbb214e32aae2d71af52d748a3aee
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: I270c70f6cda733ca6121d0761b4c1c162104d379
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: I6a329d28e13a81c9f7136737518c6bb8fa18402e
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: I475eba0a477d13cd9201c88ad44899d521ad8991
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: If4792c1bd3d5a82c24a4b2f0f84790d4eed22e67
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: Ib395106b14156a1f4000b516131684e319db78de
This isolates MediaSource code without changing the early
initialization of MediaSource, which was designed for low-latency
startup.
Prerequisite for #1087, #880, #997, #816
Change-Id: I61acedd95d73610d3e67436d9c7767d643fe2d29