Commit Graph

41 Commits

Author SHA1 Message Date
Álvaro Velad Galván 943bdb2b35 Use Network Information API to react to network changes (#2663)
Resolves #1067
2020-07-09 09:46:24 -07:00
Joey Parrish f539147d48 fix: Correct license headers in compiled output
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.

It seems that the `!` in the header forces the compiler to keep it in
the output.  I believe older compiler releases did this purely based
on `@license`.

Issue #2638

Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
2020-06-09 16:05:09 -07:00
michellezhuo 6d373eb631 Add config for low latency mode
Issue #1525

Change-Id: I561ac50b4681036b7675efdceae70937c4b9244d
2020-06-09 17:29:54 +00:00
Álvaro Velad Galván 8648a3e0fc Add option to customize the polling of expiration time (#2579)
A large value effectively disables use of the expiration time

Closes #2252
2020-05-20 14:58:35 -07:00
Sergei Gridasov 2fdbd5b676 Add new option manifest.hls.useFullSegmentsForStartTime (#2575)
If true, forces HlsParser to use a full segment request for determining
start time, in case the server does not support partial requests.

Closes #2556
2020-05-19 08:24:04 -07:00
Joey Parrish 342d35f4f9 Fix issues with nullability of numbers
Various issues with the nullability of number types led to various
fixes, including:
 - defaulting a nullable number to 0 to avoid propagating a null value
   through calculations
 - adding an assertion or runtime check that something is not null
 - moving an existing null check to before the calculation
 - returning early on null during an iteration
 - changing a nullable number to non-nullable
 - defaulting to NaN instead of null

These issues were caught by a compiler upgrade.

Issue #2528

Change-Id: I86d516c74a42ee3624c33d7513d2d4c76d3ea589
2020-04-30 16:00:00 +00:00
michellezhuo 3b52166f56 Remove support for custom DASH ContentProtection schemas
Remove manifest.dash.customScheme callback function since it's no longer used.

Closes #2356

Change-Id: I6d08fcf97cff1bf2985e7c660d74efcd767eaed9
2020-04-09 09:11:20 -07:00
michellezhuo c82ff51d1f Add a presentationDelay config for HLS live
Closes #2373

Change-Id: I627bbd226ed9cab9bc476e2c2a3257d2e2dbc0e9
2020-03-11 18:41:15 +00:00
Jacob Trimble 3f63021a2f Avoid using "new" with factories.
Instead of having the "factories" use "new" to construct them, now they
will be plain functions.

Closes #1521

Change-Id: Ia6151ad679a78a5c6db128d43094c82add0af348
2020-02-19 09:57:51 -08:00
Joey Parrish e07a965df2 Fix argument count on compiled default callback
This fixes the argument count on the compiled versions of our default
callbacks.  This makes sure we don't issue incorrect warnings about
the application's configured callbacks.

This was discovered in the compiled build of our own demo by observing
the warning logs about the wrong number of arguments in some of our
callbacks.

Change-Id: I401d54bdc706aee9a70fbf5db83fc5e7de5cb183
2020-02-18 18:00:52 +00:00
Jacob Trimble c8043f3916 Allow configuring when to fetch prev segment.
We fetch the previous segment in Live streams to combat differences
between the manfiest times and the segment times.  Now this can be
configured so apps with correct manifests can avoid the extra segment
request.

Also, we'll update the buffering state when a segment appends so we
leave the buffering state sooner.

Issue #2291

Change-Id: Id12c8132dc11739e4c8d42cb1f08e6ae7da1a966
2020-02-15 01:52:05 +00:00
Joey Parrish e82b13b311 Fix acceptance of async functions in configuration
The config merging code was rejecting async functions, because the
.constructor field of a function is the "Function" constructor, but
the .constructor field of an async function is the "AsyncFunction"
constructor (not exposed as a global).  This led to the async function
being rejected because it was misdetected as a different type of
"object" than the default value.

The fix is to exclude functions from this constructor-based
type-checking.

Note that the compiler will turn async default values into synchronous
functions in the compiled build, so an async default will appear as a
synchronous function in the compiled build and an async function in
the uncompiled demo.

A synchronous function from the app will always be okay, even if the
library expects async, because "await" will still work.  But if the
library expects a synchronous function, the app should not supply an
async function, because that will return a Promise instead of the
expected type.

This adds a test to show that it is okay to pass a synchronous
function to an async config field, which is important for backward
compatibility as we make trackSelectionCallback async (#2383).
However, because the compiler causes us to lose the native async-ness
of our default values, we can't reject async for sync fields or write
a test for that scenario.

Found while fixing #2383

Change-Id: I62891441ce75bfc887ea13c24212a2ee78f90af4
2020-02-14 15:13:03 -08:00
Álvaro Velad Galván 059e2a9a08 Make trackSelectionCallback async (#2387)
Resolves #2383
2020-02-12 13:11:17 -08:00
Jacob Trimble f7be614c42 Add option to log license exchange.
It is common when debugging protected content to want to see the
license request/response data.  This adds a configuration to easily log
the license request/response data so we can see this without modifying
the code or adding breakpoints.

Change-Id: Ib5db3eaa1447ae8714da935ee459fc7f9ba1e937
2020-02-07 22:22:11 +00:00
Álvaro Velad Galván 6e8ab0132f Add framerate restriction to the config (#2332)
Closes #2068
2020-01-08 11:33:58 -08:00
Leon Chen c6f0a86d73 add manifest.dash.ignoreEmptyAdaptationSet config option (#2330)
Closes #2023
2020-01-08 11:33:22 -08:00
Álvaro Velad Galván 8cbe54575a Allow disabling the text parsing, decoding, etc in DASH/HLS with a config (#2278) 2019-12-04 13:50:56 -08:00
Álvaro Velad Galván f6da953112 Allow ignoreSuggestedPresentationDelay in DASH (#2260)
* Add ignoreSuggestedPresentationDelay configuration

* Add test

* Change test name

* Add missing locale
2019-12-03 11:22:40 -08:00
Álvaro Velad Galván 05c03fcf64 Allow disable the video parsing/decoding/.. in DASH/HLS with a config (#2259)
* Add disableVideo configuration

* Add missing locale
2019-12-03 11:11:06 -08:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
Álvaro Velad Galván 585c725d09 Allow disable the audio parsing/decoding/.. in DASH/HLS with a config (#2196)
Resolves #2195
2019-10-22 15:00:36 +02:00
michellezhuo d520324f57 [Fix] Check initDataTransform with default implementation
Closes #2136

Change-Id: I6c98ceb48d21a26b2a1c4bc7516ee9d7279728bf
2019-10-10 14:27:24 -07:00
Sandra Lokshina 8d4f9a492b Add config for using src= on Safari.
Closes #2116.

Change-Id: I4742037563a20e2e585a6dfbeae29a65bffe2117
2019-08-29 16:07:19 -07:00
Jacob Trimble d7fc19ab31 Allow filtering out failed HLS text tracks.
This adds a separate configuration value for this because (a) the HLS
parser can't access the streaming configuration and (b) this behavior
is different in that the streams are removed instead of just not playing
them.

Closes #2065

Change-Id: Ic9b1e0d40b161cd4ba0eb6d7c922882112034626
2019-08-12 18:16:28 +00:00
Jacob Trimble c5b9d6804f Allow custom content ID in FairPlay.
Now there is a generic callback to transform the init data before
passing it to the browser.  This can be used by apps to use a custom
content ID in FairPlay content.  This also adds some utilities to help
in writing these functions and moves the default behavior to DrmEngine.

Closes #1951

Change-Id: I78ce660c126b53a69d5f55b16775ffcdbbe4d748
2019-08-07 18:38:40 +00:00
Joey Parrish 08cec995c9 Replace find/get callbacks with SegmentIndex
This replaces find/get callbacks in Stream with a SegmentIndex.  With
the exception of DASH's SegmentTemplate+duration, all manifests were
already backed by SegmentIndex.  Now, all manifests are backed by
SegmentIndex.  This will simplify Period-flattening, in which all
tracks will be represented by a list of segments, some of which come
from different Periods.

The SegmentIndex in Stream will not be created until
createSegmentIndex is called.  Prior to this change, the find/get
callbacks could be invoked without createSegmentIndex() in some cases
(excluding DASH's SegmentBase), which some lazy tests took advantage
of.  Now that find/get are methods on SegmentIndex, createSegmentIndex
must be called in all cases.  The tests have been updated accordingly.

Making SegmentIndex generation async in all cases exposed some issues
with the parser context being modified in-place between one
Representation and the next.  So the parser now makes a shallow copy
of the context before it is bound into an async callback.

To facilitate updating the SegmentIndex for SegmentTemplate+duration
content, SegmentIndex now has a method to update its list on a timer.
Once per segment duration, the index will be updated to add and remove
SegmentReferences.

The initial expansion of SegmentTemplate+duration will be limited to a
relatively small number of segments, to avoid excessive CPU or memory
consumption.  This defaults to 1000 segments, but is configurable.

Issue #1339

Change-Id: I99c007b1096c3b396d04a729750cd7b743cb899d
2019-07-08 22:22:13 +00:00
Theodore Abshire 5369d11c7b Also export PlayerConfiguration utils.
It turns out that we do not export the PlayerConfiguration utils.
This caused the recent fix to the demo configuration section to break
the nightly, when in compiled mode.

Change-Id: I361145c900f38ae132b2fa4408e0c3a7e02364ce
2019-06-06 19:55:25 +00:00
Joey Parrish bd787fd069 Raise the default bandwidth estimate
For browsers without NetworkInformation API, a configurable default
bandwidth estimate is used until we have enough data to build a real
estimate of our own.

This raises the default to 1Mbps.  Applications can still set their
own default.

Change-Id: I86d7e7b028e9bf8c8e928d4db28cd1683ebc8646
2019-05-13 22:37:04 +00:00
Jacob Trimble f130dffcef Enable eslint indentation rule.
This is a fully automated change.  The linter will fail because the
extra indentation caused line-length errors.  These won't be fixed
automatically.  They are fixed in a follow-up to make this one fully
automated.

Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
2019-05-13 22:31:09 +00:00
Joey Parrish 615b46d70c Fix initial bandwidth estimate on Chrome
The Network Information API gives us an initial bandwidth estimate on
Chrome and Opera (and others, some day).  But the API changed slightly
in a way that broke our detection of it.  This restores the
functionality so that our initial bandwidth estimate is closer to what
we will converge on during playback.

Change-Id: Iaff9224c98127e6fcad1f188d73d243a45f36cd7
2019-05-13 22:29:02 +00:00
Jacob Trimble 0dd64074b9 Only allow one statement per line.
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.

Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
2019-05-13 22:11:50 +00:00
Jacob Trimble ded2b84313 Require consistent return values.
This enables the eslint rule that requires all functions to consistently
either return a value or not return a value.

Change-Id: I98b579f3689c3b6c74968116824231bb792bd9dd
2019-05-09 20:34:47 +00:00
Aaron Vaage fd2d61d027 Make Stall Detector Configurable
Make the stall detector configurable via Player.configure. This
should make it easier for developers to work around stall issues
and make it easier for us to find ideal configuration for
different platforms.

This exposes:

- Enabled   : A flag for whether or not the player should
               initialize and use a stall detector.

- Threshold : The number of seconds that must pass without
               progress before firing the stall-event.

 - Skip     : The number of seconds to skip forward after a
              stall-event.

To make enable possible, the stall detector was made optional and
is now passed into the gap jumper. This allows Playhead to evaluate
the config and create the detector as desired.

Issue #1839

Change-Id: Ife1bf34b4cfc7b469f4b0beb312a06d5b5cd81a9
2019-03-20 19:19:03 +00:00
Jacob Trimble 2d99929400 Add option to disable drift fixing.
The drift fixing allows us to play content that has drift by starting
to play at the last segment in the manifest.  But some live content
specifies content in the future, so we can't just start playing at the
last segment in the manifest.

Fixes #1729

Change-Id: I3095a2d28b34ed93346933f561d77335361f1fae
2019-02-15 22:50:16 +00:00
Tomáš Tichý e3739c9495 Add safeSeekOffset to StreamingConfiguration (#1726)
Closes #1723
2018-12-14 11:01:50 -08:00
Aaron Vaage b84e74e825 Use Language Terminology In Our Code
Now that we have a formal terminology for how we talk about
language and locales, this change updates our code to utilize
our new vocabulary.

For more information on our terminology, see our "Talking About
Languages" document.

While the expression of the behaviour has changed, the final
observable behaviour should not have changed. The goal of the
"rephrasing" was to build our logic based on the concepts discussed
in our "Talking About Languages" document.

Change-Id: I16c405e3d5a4d1e2275c99d5ec0bbdbaaf8373b9
2018-11-15 20:11:20 +00:00
Jacob Trimble f78471eb7c Misc Storage and demo fixes.
- Fix assertion about deprecated configuration path.
- Fix running Storage.configure() with drm configs.
- Fix null reference error when certain errors happen when storing.

Change-Id: I5a7b5178ed01febcc11f323bf6dcdf4eadaaa241
2018-10-04 15:55:58 +00:00
fadomire 99ebc693f2 Add config field to ignore manifest minBufferTime #1547 (#1581)
Add the config field manifest.dash.ignoreMinBufferTime, which will default to false. If true, the DASH parser will ignore minBufferTime in the manifest, such that streaming.rebufferingGoal is the only factor in play.

Closes #1547
2018-09-21 12:51:33 -07:00
Aaron Vaage f8b707aaeb Use Sets For Uniqueness
Update all our code to use |Set| to handle storing and testing
unique values.

Change-Id: Id809d4d84e4779ae19be58eca96983750c3f3a81
2018-09-14 22:03:04 +00:00
Joey Parrish bb646befca Fix issues found by newer compilers and linters
Some of these issues were found by the Closure Compiler linter,
which we are not currently using here.  I will try to re-enable it
in a follow-up change.

Change-Id: Ie6e75f2b5a1e0f888c3dfbc78ed9cf254d2738bb
2018-08-09 12:22:34 -07:00
Aaron Vaage 272e6bd922 Merge Offline Config into Player Config
As part of the effort to allow storage to be initialized with or
without a player instance, this change moves the offline config
into the player config and changes storage to share a configuration
object with a player instance.

We opted to share the instance between the two classes because if
storage was initialized with player, the initializer is implying a
relationship between the two objects and therefore configuration
changes should be shared.

Issue #1297

Change-Id: I991365255e63c284fbfcf147cf63c9588dd764ab
2018-07-31 22:07:02 +00:00