This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs. This does not
affect the compiled output, and is only done for consistency.
Issue #2638
Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
Before we buffer a segment, video.currentTime will be 0, even for live
streams. So this should not be used in getPlayheadTimeAsDate().
Instead, we should use the Playhead time or the time that will be used
later once content is loaded.
Bug: 149549467
Change-Id: I585fd2364003021839bc16724f41510637489326
In many places in the tests, we used "Object" or "*" or just no type
at all for various fakes. These were all flagged by the new Closure
Compiler version we are adopting.
In some other places, we mixed up similar types or had the wrong
nullability on a type.
In still others, types were missing fields.
These issues were caught by a compiler upgrade.
Issue #2528
Change-Id: I324e0b28f7e30a4102aa26ec2c9901fa9732211b
When period-flattening combines Streams, key ID arrays would get very
long with duplicates.
This changes keyIds in the manifest and offline structures from Array
to Set.
Issue #1339
Change-Id: I003d23e567efafa771ecd2ad597900181604ad18
Period-flattening will concatenate Stream objects, so this information
should be available per-Stream instead of at the Variant level.
Issue #1339
Change-Id: I96195fea48cab1e4a349b2ab0b16064a443e928a
This removes periods from the internal manifest structure and cleans
up code and tests accordingly. This leaves us unable to play
multi-period DASH & offline streams until the main period-flattening
algorithm is completed in shaka.util.Periods.
Three test cases have been disabled for the moment.
Multi-period playback will be restored in a smaller, more focused
follow-up commit, with disabled tests re-enabled.
Issue #1339 (flatten periods)
Issue #1698 (rapid period transitions issue)
Issue #856 (audio change causes bitrate change)
Closes#892 (refactor StreamingEngine)
Change-Id: I0cbf3b56bfdb51add15229df323b902f0b2e643a
SegmentIndex has had a destroy() method for a long time, but it has
never been called. Now that SegmentIndex has a timer which adds new
references for DASH SegmentTemplate live streams, it is more important
than ever to properly stop this active part of SegmentIndex.
This change replaces async destroy() with synchronous release() and
calls it from Player when the manifest is being disposed of. This
will ensure that SegmentIndexes don't grow out of control after
content is unloaded.
This would not have affected v2.5, since we didn't have this
timer-driven growth of DASH SegmentTemplate live streams in that
release branch.
Related to #1339 (fixes issues introduced for period flattening)
Change-Id: I419a06a62eaa507d92132e20d4cc2d6e45c83ff2
Player.load and Storage.store used to accept the manifest parser factory
directly. But now they should only accept the MIME type string. This
removes the deprecated functionality in preparation for v2.6.
Change-Id: I1b4c5a4a9f0b6edbea909d18111ddc87a39da331
Instead of having the "factories" use "new" to construct them, now they
will be plain functions.
Closes#1521
Change-Id: Ia6151ad679a78a5c6db128d43094c82add0af348
This makes the config-rejection logs always-on in compiled mode, to
help application developers notice problems during upgrade.
Found while fixing #2383
Change-Id: I131a1bf8197da394a743e9a121348178d38e5948
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
Before, we checked either the audio role or the video role matches the selected role,
but we should check only the audio role when selecting audio language.
Closes#2346
Change-Id: I040f41129dc902cce79c66ba36cb10917fcc8453
This changes the eslint rule to enforce a strict pattern for the
argument comments. The comment must appear before the argument and
must be /* foo= */. This still ignores line comments.
Change-Id: I3afb01c65e1088eda13facb3aeeaa7595a2f5aee
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
Before we would only update the current Period when we got a key status
change; this caused us to fail playback for the second Period if the
streams were restricted. Now we update all the Periods.
Closes#2135
Change-Id: I2238a90c1d367a1d898ec26e4318852cd26da4b7
This allows us to avoid suppressing the indentation rules and ensures
we have correct indentation. It also makes it harder to make mistakes
since the variables are only accessible within the callback and you
can't accidentally contaminate another object with an incorrect call.
Closes#1692
Change-Id: Ic38b5cd57a2587dfc8c115ba782656c15565b655
These factories require actual functions, not arrow functions. This
was only working so far because of Babel translating the code to ES5.
Closes#1953
Change-Id: If05d11f4a66f920077343c3e1759964f41e4433c
This fixes a TODO and fixes setting the "active" track when switching
languages when not displaying text.
Fixes#2010
Change-Id: Ic4cf4126ffb9b93a09af998e20f9da0e7af852fb
This is a helper to aid in iterating over items. This returns a list
of objects that contain:
- "item": The current value.
- "prev": The previous value in the list.
- "next": The next value in the list.
- "i": The zero-based index in the list.
Issue #1518
Change-Id: Id18ab977e3ae45dfbfd2b4137a1bffb6e53c6bce
This ensures that we get the expected types and that type coercion
doesn't convert between types. This also ensures we are consistent
in how we check for equality of primitives in tests.
Change-Id: I9f3aacdf25ab1afe5e8d6e4b895b5299ee687d54
- Reduce times for "short delays".
- Remove backoff delay from networking tests.
- Avoid hard-coding delays in the library.
- Move Storage tests to integration tests since they use indexedDB (and
take over 200ms each to run).
This reduces the time it takes to run unit tests (with --quick) from
50 seconds to about 6 seconds. Now all but one unit test finish <100ms.
Change-Id: I88461472a87c4cf750a36d07d07422818e069a4d
These allow you to use expectations for async methods. This is
especially useful for expecting failures.
Change-Id: I7281b0c1370aab688957f3d77affdc9d3044ce74
Creating them in beforeAll will usually cause test contamination, so
they should be created in beforeEach instead so they are reset for
each test.
Change-Id: I51f11de85555cbf5b8c18969eabeecbe8617b8f3
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
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
We use custom indentation for the ManifestGenerator to make the repeated
calls easier to read. This disables the coming linter rule for these
blocks of code. This also goes through and unifies the formatting. The
indentation should be 4 spaces from the left side.
Change-Id: I687e69cea39bded1e9e06bffdcc888970b383fa2
With this change, offline and UI config can use the same two-argument
short form that the Player config interface offers.
Change-Id: I5f40ef58da76f3aab1d7178fe7d6e82097352b9a
This is an automated change to convert use of "function" functions
to arrow functions. This doesn't change all uses of bind() that
could be converted. This also doesn't remove all "function" functions.
Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
A coming update to the Google eslint config will require using "const"
over "let". This makes that one change to isolate the big changes.
Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
Track methods are now implemented for native HLS and other src=
playbacks. This will allow the UI to select text and audio languages.
This change adds best-effort methods to get track information for src=
playbacks, including native HLS on Safari. In many cases, it relies
on the audioTracks and videoTracks members of HTMLVideoElement which
are only implemented on Safari. They are in the spec, though, so
there's no harm in using them when they exist.
This is fully parallel to the manifest-based paradigm for MSE-based
playbacks. Each of these top-level methods in Player has an "if" to
decide which way to supply the requested info, except for the language
methods, which now delegate to the track methods.
With this, Safari's native HLS can supply audio and text language
information to the UI/app, and the UI/app can have some control over
those things through the tracks API. I believe this is important to
the success of our new iOS support.
Issue #997
Issue #382
Change-Id: Icc44a932927fafedda1b62a9d4c6e2ed3dc7db30
Previously there was a boolean that held the "is buffering" state,
however with the buffering observer directly assessable, we can just ask
it if we have enough content.
Change-Id: Ic5adb2b54fc7a7f6d732520ac257bf4ca1407287
Before the buffering observer was a playhead observer, but with
supporting src=, changing how we interact with the buffering observer
was made easier if it was handled as a top-level component.
This meant moving it off the playhead observer interface and create its
own timer in player.
Coming off the playehead observer interface, the buffering observer did
not need to use callbacks, which made it easier to use. This will also
allow us to use it as the single source of "is buffering" in a later
change.
Change-Id: I8cad9bfde3309de7c2b8301b90aa8c40b6e4d247
This change makes state history track any state by moving the idea of
buffering, playing, etc to the player.
This allowed the stats and state history to drop they connection to the
media element.
Change-Id: Ieed198a09b3ade33e4ee850445b809f251cf2558
|findVariantForTrack| was only called from one place in the library and
once in a test. There were ways to get the same behaviour without
needing a utility method in a different class.
The CL inlines the behavior in the player and replaces how the test
handles its logic.
Change-Id: I82e3b7933cc6b4da4b8b2d2da07b405900ecba8b
This change takes the part of |onLoad| that creates media source
engine and makes it into its own state in the graph.
This allows us to pre-initialize media source engine and will allow for
the load-process to be aborted after initializing media source engine
but before load.
This ensure that we only initialize media source engine once per load
(fixing #1570) by modeling "initialized media source" as its own
node in the graph.
The tests that appear to be removed from "player_integration.js" have
been moved to be with the other load graph tests and re-written to
make use of the load-graph events for testing.
The stats test that appears to be removed from "player_unit.js" was
moved to "player_integration.js". This test was failing before the
player was not overriding media source (like the other tests were) since
this one had to do with load order, it was moved to be closer to the
other load order tests.
Issue #816
Issue #997Closes#1570
Change-Id: I646f0559e3878f28374a3fc56f3d70f6d8a462a4
This is the initial integration between the walker and the player. In
order to make this simpler, this keeps all of "load" as one transition
and will slowly break it into multiple parts in later CLs.
Tests that focused on verifying the changes in states were moved from
the unit tests to the integration tests.
As of this CL we model the load graph as:
Detached -> Attached -> Loaded -> Unloading
^ ^ |
| | |
+---------+-----------------------+
With this CL we lose:
- Interrupting manifest load retries when interrupting a load.
- Interrupting loading.
- Pre-initializing media source.
We have immediate plans to add back:
- Interrupting loading.
- Pre-initializing media source.
We are still designing how to handle:
- Interrupting manifest load retries when interrupting a load.
Issue #816
Issue #997
Issue #1570
Change-Id: Ie929621f94c2701f7d4e031b7a31dbd1c74a69c6
Before we had one central playhead observer that would monitor multiple
different relationships:
1. Buffering
2. Periods
3. Timeline Regions
This CL breaks each observer into their own class (allowing for them
to be tested independently). To allow the player to be ignorant of which
ones are in-use, a playhead observer manager has been created.
The player is responsible for creating the observers since it has the
knowledge of what ones need to be created (and the references to
everything).
As part of breaking the observers apart, the Region Timeline was broken
out so that the observer has something to observe (similar to how the
buffering observer observes the buffered region and the period observer
observes the periods).
Change-Id: I18bf0f45561f3bac44da50c0d00a02f8b1fbf3cf
Before, media source engine could be created with no text displayer.
However, player would always create media source engine with a
text displayer.
Just like with closed captions, this appeared to be a good time
to change it to be passed in the constructor and have media source
engine own it.
This now means that media source engine is responsible for destroying
it - lessening player's responsibilities.
Change-Id: I71cd1c28a3c22d3c765a3892fe74ae3f9abd1914
This change takes playhead and its internal members and moves them
over to use the IReleasable interfaces instead of the IDestroyable
interface.
Change-Id: Iddb525725591a29a61ca6b5e2ad519ab708164eb
There we a couple different fake text displayers in our tests. This CL
take them all and consolidates them into one fake text displayer.
Change-Id: I889aa4f11660d641920b0628e7e91549cb715c6a
To make it easier to understand the context of the streams
and periods returned by StreamingEngine, "getActive" is
renamed to "getBuffering".
Change-Id: I99aec589bd4d736b170fa2197e5097ff33c0fc82