Commit Graph

33 Commits

Author SHA1 Message Date
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
Álvaro Velad Galván 6f9b36f755 Allow OPUS on Tizen 5 or higher. (#2564) 2020-05-11 15:07:04 -07:00
Joey Parrish 80f53221fd Correct minimum supported Safari version in README
Also add a note to the MSE polyfill about restrictions being applied
in Player as well.  We used to restrict Safari versions only in the
polyfill, and I had forgotten about the other version check.

Closes #2548

Change-Id: I4d2f319939c3a079e7f0ec7134876d91fc425bf4
2020-05-05 14:47:08 -07:00
Joey Parrish 917e788271 Fix exception thrown for Chrome & Firefox on iOS
Because we have some polyfills and blacklists that are specific to
Safari and iOS, we need to detect specific versions of Safari and iOS.
The existing detection of Safari/iOS versions was in multiple places,
and did not account for non-Safari browsers on iOS.  This refactor
allows us to correctly detect iOS Chrome, and fixes a fatal exception
thrown in the MediaSource polyfill for all non-Safari browsers on iOS.

Change-Id: Ic88dc1a4c82087054cd4791dbf295b7ea2aeab09
2020-02-04 18:57:51 +00:00
Jacob Trimble 011749e95f Standardize argument comments.
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
2020-01-06 19:40:52 +00: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
Joey Parrish 65370b4b99 Update MediaSource polyfills for Safari 13
Safari 13 is out, and needs polyfills just like Safari 12 did
(although one fewer).  This assumes that Safari 13+ all need the same
polyfills (to avoid surprise failures when Safari 14 comes out).

This also raises the minimum version from Safari 9 to Safari 11, since
usage stats for Safari 9 and 10 are vanishingly small.  Dropping
support for Safari 9 and 10 allows us to delete a complicated polyfill
used for those versions.

Change-Id: I8f833d915215fc19a89e3aea292b67c5d677c779
2019-10-08 15:36:38 -07:00
Joey Parrish 0e20f69e8d Fix Chromecast MSE polyfill
The Chromecast MediaSource polyfill was broken in "Avoid integer for
loops", Change-Id: I3ba3cb6a439264e823022b2a64e7cdbd265494c7.

This particular loop used to start at index 1, and the previous change
made it start at 0.  Because of a test infrastructure failure that
prevented testing on Chromecast, we missed this mistake.

This bug did not affect any release versions.

This fixes the bug by using shift() to remove the first item before
the loop, instead of [0] to access it in-place.

Change-Id: I3aa53436e23a1b389375df2b06b3bbbab18ecf0b
2019-07-17 20:26:05 +00:00
Joey Parrish 85ba5e49bb Ignore case in MIME type checks
Closes #1991

Change-Id: Ib76f7539ff5173fca1ddb409e33240e7e9d3fd11
2019-07-09 20:24:50 +00:00
Jacob Trimble 5c35108cb8 Avoid integer for loops.
Issue #1518

Change-Id: I3ba3cb6a439264e823022b2a64e7cdbd265494c7
2019-07-09 17:11:49 +00:00
Jacob Trimble 3da809019b Enable additional ES6 linter rules.
Change-Id: I6861541b27153ba034364a5972a9b086de581cef
2019-06-11 18:35:09 +00:00
Theodore Abshire f584c9aab6 Convert remaining polyfills to ES6.
Issue #1157

Change-Id: Ie330cd870ccf14dc3f56987b2787970b46b1ac89
2019-05-29 23:39:08 +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 47daf49f31 Use arrow functions for callbacks.
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
2019-05-09 16:40:46 +00:00
Jacob Trimble c81389741f Prefer const over let.
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
2019-05-08 09:22:10 -07:00
Joey Parrish 133f161b93 Support all types of single-file playback
Instead of triggering src= based on 'video/mp4' MIME types, ask the
browser what it can support using video.canPlayType().

Querying canPlayType() also allows us to detect src= support for
native HLS in Safari.

The original version of this change also added a complete fallback
system to detect MIME types based on common file extensions and
fetch MIME types via HEAD request when necessary, but the load graph
system does not yet allow us to make async decisions about destination
node.  So this async MIME detection is commented out for now.

Closes #816 (src= single file playback)
Issue #997 (native HLS in Safari)

Change-Id: If1930ca4fd5710481a925d63fb312d9a5b15fec8
2019-04-16 22:59:18 +00:00
Aaron Vaage 040ecf6978 Create src= node
This CL creates the "loaded with src=" node and its initial
implementation. Adding this node required some changed to the routing
logic as a new destination was created.

We will use src= when given mp4 content or media source is unavailable.
We detect mp4 content via the mimeType in |load| and/or the file
extension. When media source is not available on a platform, we fall
back to using src=. To do this, we check if media source is available
whenever |load| is called, and will route to the src= branch if media
source is not found.

To avoid pre-initializing media source (when it is not available) we
modify the |initializeMediaSource| flag in |attach| and |unload| when
media source is not available.

Doing this showed that we had inconsistent behaviour between |attach|
and |unload|. |attach| would default to initializing media source
whereas |unload| would not. This has been fixed.

Issue #816
Issue #997

Change-Id: I00599832b49c9079e273e65a4b827fee736479cc
2019-04-01 22:56:39 +00:00
Bart Teeuwisse 7660edc995 Dolby Vision fixes for Chromecast (#1844)
- Fix the link to Dolby's Dolby Vision Profiles and levels PDF
  - Was pointing to a document version that no longer exists
- Update Dolby Vision regex to match all DV codecs
  - Dolby Vision is available in 4 different (base) codecs: dvhe, dvh1, dvav, dva1
  - dvh* represents HEVC-based Dolby Vision
  - dva* represents AVC-based Dolby Vision.
- Do not remove Dolby Vision codecs on Chromecast

No need to remove Dolby Vision codecs on Chromecast. Chromecast's canDisplayType will reject them when the cast receiver or the attached display can't play Dolby Vision.

On Dolby Vision capable cast receivers attached to a TV in Dolby Vision mode, canDisplayType does not reject Dolby Vision streams. One such device is the Chromecast Ultra. With this change, Shaka Player plays Dolby Vision on qualifying setups.
2019-03-18 15:43:37 +05:30
Aaron Vaage 1506182de9 Reject opus content on Tizen
Tizen Smart TVs do not play opus content well when using MSE. To prevent
Shaka Player from trying to play opus content on Tizen, we override
media source's isTypeSupported to reject opus content.

Since most content will have AAC as a fallback, this should not limit
playback on Tizen.

Issue #1751

Change-Id: Ia61a1d26f547082fa68a9f38e4af16951191dd4f
2019-02-12 20:54:57 +00:00
Joey Parrish 2872f31e01 Add polyfills for Safari 12
Now that we have Safari 12 in the lab, we have found that it requires
the same MediaSource polyfills as Safari 11.

Fixes b/120434307

Change-Id: I45f8be79d0aca7987ffcba1ce13b8589a2287712
2018-12-12 10:47:39 -08:00
Joey Parrish 7091275cbf Replace indexOf with includes, startsWith
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
2018-09-14 19:10:56 +00:00
Joey Parrish fd0449d8f7 Re-enable some disabled style rules
This re-enables the following style rules:
  - "block-spacing"
  - "brace-style"
  - "comma-dangle"
  - "comma-spacing"
  - "new-cap"
  - "no-multi-spaces"
  - "no-multiple-empty-lines"
  - "one-var"
  - "padded-blocks"
  - "prefer-rest-params"

Change-Id: I15d616e8d5b88b273ded6128b4f9ad86bdb26bd1
2018-07-09 19:44:56 +00:00
Jacob Trimble 759eef9685 Change goo.gl links to bit.ly.
https://goo.gl is being turned-down, so we can't use it for new URLS.
So we have consistent short links, this converts them to be
https://bit.ly.

Change-Id: I07a86cba807b67157664893341f648023918d0de
2018-06-22 20:20:00 +00:00
Theodore Abshire d46e8fdf92 Typo fixes and rewording in comments, part 6
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: I2bfa4d531a8fcdcf9578e9c181c4534ad7443b7a
2018-03-21 17:59:42 +00:00
Jacob Trimble b512db87dd Convert 'var' to 'let'/'const' (8 of 9).
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
2018-02-20 11:29:30 -08:00
Theodore Abshire c6ddf593e5 Polyfill Safari 11 MSE bug in SourceBuffer.remove
SourceBuffer.remove, when told to remove exactly up to a keyframe,
will also remove that keyframe and all of the content till the next
keyframe. This results in far too much content being deleted, and is
breaking our tests on Safari 11.

Patching this by offseting the end of the removal range by 1ms seems
to be a viable workaround.

Closes #1048

Change-Id: I062b2dc2617f1372f885f4ccbc906d77c65412d7
2017-10-05 13:15:25 -07:00
Joey Parrish 859d7d1a8f Reject TS content in Safari
Because Safari's support for TS via MSE is broken, reject all TS
content in Safari.  Transmuxing (#887) will compensate.

https://bugs.webkit.org/show_bug.cgi?id=165342

Closes #743

Change-Id: Iff8a6a7c159e48a4f388d99396915752e649c6ac
2017-10-03 15:31:10 -07:00
Joey Parrish 87b723473b Apply MSE patches to Safari 11
One of the Safari 10 bugs we work around is still present in Safari 11.

Issue #1048

Change-Id: I54e146bcce9770f980a0dabd477a86b482a6c901
2017-10-03 15:31:09 -07:00
Joey Parrish b7b890b908 Add a polyfill for Chromecast isTypeSupported
There are several issues with isTypeSupported on Chromecast that
require workarounds in JavaScript:
  - Dolby Vision strings must be removed from the codecs parameter,
    even though the content is supported by the platform
  - HDR must be guessed at from the codecs parameter and an additional
    parameter must be added to query HDR support
  - Queries must be made through a non-standard interface

Change-Id: I4c8c70e70cf9c26283913783f5f62f7d6470c2f1
2017-08-17 17:35:00 +00:00
Jacob Trimble b974a1d12d Fix field renaming in Safari polyfill.
Closes #974

Change-Id: I407f7d0437383e05c42c0762bad42337bd558f8c
2017-08-15 17:21:38 -07:00
Jacob Trimble adb8da4764 Disallow unknown properties (1/5).
This is part of adding a new conformance rule to add additional type
safety.  This will disallow using properties of unknown types or using
unknown properties.

The first parts will be fixing errors caused by the new rule.  These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.

Change-Id: Iefde089b2f62ddfdf43944cda5badab438577561
2017-06-27 19:43:00 +00:00
Joey Parrish 5963e0ddd4 Update MediaSource polyfills for Safari 10
Safari 10 has some new MediaSource implementation bugs that need to
be worked around.  This updates and refactors the polyfills for Safari
10.

Bugs filed:
  https://goo.gl/qCeTZr
  https://goo.gl/rC3CLj

Closes #615

Change-Id: Id694798cd083878f337c0ba6e017fcdaac3c69be
2016-12-05 19:43:10 +00:00
Joey Parrish 8c7c74e950 Polyfill Safari 9 MediaSource bugs
This adds a polyfill for a Safari 9 MediaSource bug where calling
abort() on SourceBuffer causes the decoder to fail.

The reason we call abort() at all is to reset the decoder and smooth
segment transitions on Chrome, Firefox, and Opera.  Safari does not
seem to have this problem in the first place, so it is fine to
completely stub out abort().

Issue #446

Change-Id: Icbaaa3e9ce5372efdee937ddc4cf94a27dce6a47
2016-07-29 18:42:31 +00:00