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
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
This is only some of the warnings produced. These were not errors,
but we should fix them anyway so that we can adopt stricter settings
in future.
Change-Id: Ifd12f0e7c69f8f4b3d0d78b11794da2569a06d77
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
|findPeriodContainingVariant| was only called from player and was only
called once. This CL moves that method into player and renames it to be
|findPeriodWithVariant_|.
By moving it into this class and making it private, we are now
communicating the limited scope of the method.
Change-Id: Icef14105feb4012e760dc5a8f1bdfb6ad9b04151
|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
We need to find the current period for a given time in two places:
streaming engine and period observer.
This change takes the method used by streaming engine and the method
used by period observer and merges them into a common method in
|shaka.util.Periods|.
Change-Id: I4f681ceaef38bf2118fb4b87fe4961fddd196707
|findTextStreamForTrack| is only called from one place in player. This
change inlines that one call so that we don't need to have a utility
function is another file.
Change-Id: I0930aec3429878cf67cfe5a7e4d52982a9f10327
Refactored |StreamUtils.getAllVariants| to get variants from a collection
of periods (rather than a manifest). This allows us to avoid needing to
assert that the manifest exists (when we know it will).
Looking long-term, as part of the refactor the method was moved to a
period-focused utility class. The goal of this is to make it easier to
see what methods may go away when we flatten periods.
Change-Id: I50aa97583892361ee4714a7beaf61e4cd95fb6b4
The only use of |findPeriodContainingStream| is in StreamingEngine,
so this CL moves the definition of the method into streaming
engine.
Change-Id: Ice7b8e04bca554bcc8ea0a52bf42f3c048d137ac
A little while ago we added the methods getSelectableVariants and
getSelectableText to create a way to get the variants and text that
could be selected. They are used with |selectAudioLanguage| and
|selectTextLanguage|.
Since we were using them for selecting variants and text, it would be
a good idea to use them when creating variant and text tracks.
A natural fallout of this change, was that the |getVariantTracks| and
|getTextTracks| methods in |StreamUtils| started to look less-and-less
important. Part of this was due to |ActiveStreamMap| storing actual
streams and not ids. So in this change, you will see that the utils have
gone away. This did require a change in |Storage| but splitting this work
across multiple CLs felt unnecessary.
Change-Id: I2d9b5b0d7b70a6b2c2e7fa51d111030cb43aa68c
This change defines a class to make it easier to track and return our
external stats record.
We have an external stats type used to communicate internal details about
what is happening during playback. The code for creating and updating the
stats was all in Player. With our src= work, only some of this data will
be trackable. To help, this change defines an internal stats class that
handles partial updates and then creates the external stats type when
requested.
This CL moves some complexity out of player, allowing the player to
focus on providing meaning while the Stat's object focuses on tracking
and storing it.
Change-Id: I8c19c98fde26c198566f33f6cbfead2826e39053
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
Adding support for CEA closed captions embedded in video streams for
Dash.
1. Dash parser reads and parses closed captions' channel and language
information.
2. Player creates text streams for the closed captions.
3. Media Source Engine calls mux.js Caption Parser API to get the closed
captions embedded in the video streams.
4. Text Engine stores the closed captions, and text displayer shows the
captions.
TODO:
1. Add test cases, will send out another CL.
2. Change closed captions support for hls to the similar way we handle
dash closed captions, will send out another CL.
3. Handle dash content that's missing language indication from the manifest.
Issue: #1404
Change-Id: Ibae8f69623c13561415ec860107d7f5bc86e19e9
Change player to use the new adaptation sets and adaptation set
criteria to handle picking variants.
Issue #1071
Change-Id: Ia31002c4202e01182f7c39f25391114393230652
In this change I try to isolate the code that takes the current
period and selects the variant and text stream that should be
played.
Through this, some logic has been pulled up from lower levels to
higher levels in an attempt to better illustrate what is being
done.
Change-Id: Ie5dd4be044de5f5b8d46e28b281cca468b640af6
This replaces almost every instance of indexOf on both String and
Array. There are very few places where we really wanted an index.
Mostly, indexOf was used to check for inclusion.
Change-Id: I08e299768b6ffdb4bfc30b39b5d82a058c6d1b56
Since we pass in preferences and not a config object it made sense
to call it filterVariantsByPreference.
Change-Id: I288569ee91f3b19e3927489bf020142fbf3306f7
There was a stream utilty was that only be used in one class
(another utility class). The method was to get tracks, but it
sat along side other methods that look similar but were different
in very small ways.
This change moves that function to be in the same class as where
it is used so that it will be less distracting from the other
getTrack methods.
Change-Id: I21737b6b1341c06b41e6016e24b2b20ce5d40e77
There was an ugly promise chain in Storage.loadInternal. This change looks
to clean up that promise chain and to use async syntax instead.
Part of the refactoring splits |loadInternal| into two more focused methods
as an effort to make the code easier to understand.
Change-Id: Ica113344c6c4ba1d82b6cee281268e20be1aa411
While working on #1505 I made some changes to |filterNewPeriod|
to make it easier to see which streams were getting rejected
at a high-level.
This helped by making it easier to see which streams would
get rejected and which streams were accepted. This made it
easier to see the differences between which streams were
playable and not playable.
Change-Id: I0558de50552a614692488a6c78d46b5ea345bc7b
While working on #1505 I made some changes to |meetsRestrictions|
to make it easier to why a stream may not meet the restrictions
while debugging.
I also found that there were some special cases (video.width and
video.height being undefined) that were not well explained in the
code. In this change I try to make those cases more explicit.
Change-Id: I61f7732a30bd391f9ca14cd21f25ccfb8ed33ac7
The DASH parser will now expose Representation IDs via new fields in
the Stream and Track objects. The "id" field will continue to be a
unique, auto-generated numerical ID, and will be supplemented by a
nullable string containing whatever was originally in the manifest.
The HLS parser will now expose the NAME attribute in the originalId
field as well.
Bug: 112087288
Change-Id: I6b8107d27780fb97ab18de767f7abdc6c7110fe7
Added two new stream utils for practices that pop up multiple
times in our code base.
1. getAllVariants - Get all the variants in a manifest.
2. getVariantStreams - Get all the streams (audio and/or video) back
as an array.
Change-Id: I87fa4959e4a17dcfff20d5aa0678e6dc346d413e
When reading through player I saw we did something like:
let variants = period.variants;
...
shaka.util.StreamUtils.applyRestrictions(period, ...);
...
doSomething(variants);
This causes some confusion as it was not clear if |variants| would
still be valid to use (i.e. could applyRestrictions) change the
reference in period like we do in some other filter functions.
So to help make it clear that it doesn't, I have changed
applyRestrictions to accept a variant array rather than the period.
Change-Id: I6dc080a1b1e563e5dd2789bd00fb0cfeb7de41de
In an effort to decouple Manifest from Playhead this change removes
the utility function getRebufferingGoal.
getRebufferingGoal was only used in playhead.js, playhead_observer.js, and
streaming_engine.js. However, it was used in two different ways:
- playhead.js and playhead_observer.js always used it with a scale of
one.
- streaming_engine.js used it with a custom scale and then with another
buffering value.
Since the logic inside the function was so simple and the use of the function
between call sites were different enough, there appeared to be little value
in keeping the function.
Change-Id: Ie0983a1f84516a3cf5de34cd5ed87d1e786862d8
In the initial fix for #1013, we changed the name of the channelsCount
field in both the Track and Stream structures. This would break
compatibility for applications. So even though the new name was in
some ways preferable, we must revert the name to avoid more breaking
changes in v2.4.
Issue #1013
Change-Id: Ie8f3d211c42c8046039a3db9f0926c68ad1315d9
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 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
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
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
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
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
Some platforms (such as Chromecast) support extra MIME parameters like
framerate, bitrate, width, height, and channels. Since other
platforms will ignore these extra parameters, we should always query
using these parameters.
This introduces the framework to construct these "extended" MIME types
from Stream objects. Extra parameters for other platforms can easily
be added later.
Change-Id: I8936ca93e84068da18f12127fbc8fc1a0646695a