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
This exports shaka.util.AbortableOperation, which plugin writers will
realistically need to update their scheme plugins.
Change-Id: Idfc149f06d22699a78c4d989d331619d5e74f097
Created a static method that will handle destroying a destroyable
object when you are done with it.
Issue #1248
Change-Id: I4df0569f5f5e00002600702cf24caf1ed2da7c5b
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
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 makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.
This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.
Change-Id: I225f5c7e54adf4cca8512cddae082ba50ed82e4e
This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.
This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.
Change-Id: Ibcaf21382bd78b91e589122983dd14e001bfdad5
Fixed an issue where an update call the IndexedDB was not replacing
the correct value because the key was getting changed to a string.
IndexedDB will count a missing key as a success, so check that the
value is undefined.
Issue: #1248
Change-Id: Icdd6ae263374c655170c6470df85c656b8bd3ba2
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
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
Since the database schemes for idb versions 2 and 3 used the same
data types (shaka offline version 2) this storage cell can be used
for both. The only difference is that idb version 2 has a fixed
key space.
Issue: #1248
Change-Id: Iac5cb1d57f93fdb81729b59d67d6736e29c9968c
- 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
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
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: I10f5c38a8b06b5797c6eec7492829084114514c9
Not setting the alias immediately confused the compiler, which lead to
it not type-checking the arguments. This fixes the issues that were
found, namely problems with nullable values and that Document isn't an
Element (although our code works with it anyway).
Change-Id: I9ef95673dc52dae9a811baee74b353132eb0fae3
A follow-up fix changes all 'var' definitions to 'let'. This fixes
issues caused by it. One major change is adding brackets to case
statements. Each case statement is considered in the same scope, so
defining variables in them actually are the same variable. By adding
brackes to the cases, each case gets its own scope.
Change-Id: I99b1298223786f4df415594a2e64eb31d72b2053
Fetch requests with a method of GET or HEADER cannot have a body, or
else the request will fail. Normally we had no problems with this, but
it turns out that Edge counts a body of 'null' as being defined.
This changes the Fetch scheme plugin so that it will replace null with
undefined for the body in the init data.
This also makes it so that HTTP_ERROR errors emitted by the http
plugin will include the original error, to aid in debugging future
issues.
Change-Id: I0531656dada25f97ef610d4285c225d57d7ef262
During docs review, I noticed that resolve and reject on PublicPromise
were documented as fields rather than as methods. This redefines the
types of resolve and reject so that they show up as proper methods.
Issue #1259
Change-Id: I0b7e22f9f1edf7d8ba15362306c55d7cdbd32e76
This updates jsdoc to the latest version from npm and forks a copy of
the default jsdoc template.
In subsequent commits, we will reapply our customizations to the
template and to a jsdoc plugin.
This also fixes several bad annotations that the new jsdoc failed to
parse.
Issue #1259
Change-Id: I00a47270ea4754e1c96c43ca900d5cf889ab72e6
This does not solve failures on IE11, but does make them clearer and
helps pinpoint the root cause.
Issue #1260
Change-Id: I00a10b38d1eb1f3293c3285a34bde96c631d1c74
This is a regression test for an implementation bug we caught before
it was released. It took a little longer to get the regression test
working, so this was deferred to a later commit.
Issue #829
Change-Id: I272ebe0e6fa2f0ac462c3a3d236250242f7d7192
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
This adds a general interface for abortable operations, and a specific
implementation of that interface for use internally. This should
simplify the transition to abortable network requests and others.
Issue #829
Change-Id: Icf54e23028f7454640f5ec76ca97d8a8ed5915ed
The eslint configuration is derived from analyzing the style of our
sources as they are now, plus a few tweaks.
In particular, we have disabled checks for undefined variables and use
of console, both of which the compiler handle with greater precision.
The compiler already knows what is defined in the environment through
our externs, and has specific exceptions for the use of console (demo,
tests).
We have also disabled a few checks that we should use, but will
require many changes to the code: no-unused-vars, no-redeclare,
and comma-dangle.
This commit also fixes several types of eslint errors that were easy:
- no-useless-escape (unneccessary escape characters in Regexp)
- no-constant-condition (using true/false/0/1/etc in if/while)
- no-fallthrough (caught an actual bug in one EME polyfill)
- no-irregular-whitespace (we had a UTF-8 nbsp in externs)
- no-cond-assign (using an assignment inside a conditional)
To satisfy stricter provide/require checks in the Closure Compiler
Linter, we will no longer use provide/require at all in tests. We
will still use provide in test utilities (test/test/util/) since it
sets up the namespace for us. But we will not use require there
because there is no deps management for test code.
Issue #1157
Change-Id: Icc44f51feeb568ea7d3980e693e92e560d897afd
Beforehand, if there were some text streams with a given language
which had a role, and some which did not, the no-role text streams
would never be chosen.
Now, they are chosen if there is no preferred role.
Closes#1212
Change-Id: I28b426304b1a828f500012425b8d89c94ccc3178
Before, filterStreamsByLanguageAndRole would take a period, this changes
it to take an array of stream to better match the function name.
Change-Id: I4621f98ff17d8d1c3c95162217eef9b8cf7aaebc
Before, filterVariantsByLanguageAndRole would take a period, this changes
it to take an array of variants to better reflect the function name.
Change-Id: Ic090baf4a281798ec855e369b0b4acdf519fee14
Create the pattern for how to handle database upgrades. As of this
change the only upgrade supported is from version 0 (no database).
Issue #1047
Change-Id: I9f889a9e39a190e926cf06f0720a5371bc3c59af
This adds a single integration test for cast receiver, as well as a
framework for adding more in the future.
This particular test pauses at each stage in Player.load where the
player could theoretically be polled to compose an update message, and
waits for an update message to be polled. This should help catch any
further null exceptions in the cast receiver that prevent update
messages from being sent out.
Issue #1162
Change-Id: If24486dd821275ab674960e559bd6d10776955a7
Added onComplete and onCancel events to CancellableChain so that someone
creating it can invoke their own code when it is cancelled or completed.
This is needed for the work on IDestroyable.
Change-Id: I5c274356e952ecbd43dd5e8809a6d4cb4e5e85c5
When we started fetching partial HLS segments to find the start time,
we were no longer able to start playback for content with a moof box
larger than the partial segment. This is because we parsed the boxes
hierarchically, which required the entire payload.
Now, we can selectively instruct the parser to tolerate a partial box
if the part we have includes the child box we are looking for.
This fixes playback of several pieces of HLS content in our demo app.
Change-Id: I956c8b8905dc9f1707f2b24b8248b984b1c036c6
This speeds up HLS stream startup significantly for servers that
permit this kind of request, and falls back to full segments for
servers that do not.
Closes#1106
Change-Id: I96bc7f0df0fb84b75f3a3fe43476ba0ba5fc2264
To prevent us from packing and unpacking audio and video from an object
this changes filterNewPeriod to just take audio and video rather than
a map.
Change-Id: I152f2b1762d4ff9ce21cb5b501579bca315e4e4a
Rather than creating an array just to get its length, this change adds
a new array utility called count that will just count the values that
pass the given predicate.
Change-Id: Id2944f7bce7653c3dcf03ac3cbb3905ae5acb3d6
Originally some of the logic in Stream Utils was iterating over elements
manually and doing its own splicing and index manipulations. This changes
it to use array.filter so that the logic is simpler.
Change-Id: I2a8d1db9336a574e0992e0de430afd006dea4846
There were two functions is stream utils that were used to check
for compatibility. However they were named as statements, and this changes
them to be named as questions.
Change-Id: I0ca7e4a6597910a8f65192c50b9def895e2ac437
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