Commit Graph

36 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
Joey Parrish a65ef9983b Remove partial exports, broken in new compiler
The old compiler would let us export a static method on a class
without exporting the whole class and its constructor.  The new
compiler silently ignores `@export` for any methods of a non-exported
class.

This means that for the latest Closure Compiler, we must export any
class with exported static methods.  In some cases, these are
non-utility classes with constructors we'd rather not export, but the
constructor is implicitly exported by exporting the class itself.

This was initially caught by the integration tests.  The error wasn't
especially helpful, so I added a try/catch to loadShaka that makes the
error more apparent:
  TypeError: Cannot read property 'registerParserByMime' of undefined

To make sure we do not make this mistake again, I've added a check to
the extern generator, which was already able to detect these types of
classes.  I don't know a compiler-based way to do it, since the
compiler silently ignores the export annotations in these cases.

Issue #2528

Change-Id: I797c75a8098b0bb3cf837588569f878253dec2cf
2020-04-30 17:30:36 +00:00
Jacob Trimble bc45564721 Remove deprecated ability to pass factories to load.
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
2020-02-20 23:44:51 +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 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
Morten Vestergaard Hansen deed10f37d Ignore MIME parameters in Content-Type check (#2215)
Fixes #1946
2019-10-28 11:28:51 -07:00
Michelle Zhuo 8c8552ae7c Update media files to ES6
Issue #1157

Change-Id: I82213c9a20e7aa6e506732dc0295a61d2a67b1ec
2019-05-31 17:44:36 +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
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
Joey Parrish 4854d362f5 Cover iOS in isBrowserSupported and probeSupport
Now iOS is supported for HLS through src=, so isBrowserSupported
needs to reflect that.  This makes MediaSource optional for any
browser with src= playback of HLS.

This also fixes probeSupport() to reflect the capabilities of non-MSE
platforms such as iOS, which is critical for our demo app to be able
to show the correct set of playable assets.

Issue #997
Closes #1857

Change-Id: Ic6e18587db90fff2b097a2038c16cc928e2b9438
2019-04-12 14:31:51 -07:00
Aaron Vaage 2cef461cb7 Refactor Manifest Parser Creation
Rather than have the manifest parser class return the factory
that we then need to call "new" on, we can just have the manifest
parser class return the parser.

This makes the call-sites in Player and Storage simpler and moves
the use of factory+new to one spot so that it will be easier to
remove in 2.6.

Change-Id: I2abb8da603c9226c230bb761a20eb8dd20fc8455
2019-02-15 21:50:50 +00:00
Aaron Vaage bbb7a83563 Add mime type option to Player.load
Added an option for the mime type to be passed to the load function.
Going forward this will replace the option to pass in a manifest
parser factory.

This is to help with issue #816 as passing in the mime type will be
one way for the player to know if it should use src= over MSE.

Issue #816

Change-Id: Ic356bb9f52c3977620debc8d4a09b7115a81d516
2018-07-31 21:15:44 +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
Michelle Zhuo 535de4db84 Refactor: Remove underscore from parameter names
Change-Id: Ie9e6fb59763f454f245175f23c6444f919ba8135
2018-05-08 19:21:51 +00:00
Sandra Lokshina 8065bd54a8 Change namespace from shakaExterns to shaka.externs
Change-Id: I16432351e2a266aa8fd175669aa27c44bfdffeae
2018-04-11 17:26:26 +00:00
Jacob Trimble 624acc66b8 Add curly braces to all blocks.
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
2018-02-21 11:23:34 -08:00
Jacob Trimble b2bde18a3d Convert 'var' to 'let'/'const' (5 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: If4792c1bd3d5a82c24a4b2f0f84790d4eed22e67
2018-02-20 11:26:46 -08:00
Joey Parrish 2f55d2a3bd Use AbortableOperation in networking
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
2018-01-29 19:23:47 +00:00
Jacob Trimble 575f2ad109 Add an indicator for critical errors.
This adds a severity field to Error objects.  This can be used to
detect whether an error is recoverable.  All the same errors are still
reported so the field can be ignored.

There are two possible values:
* RECOVERABLE means that the Player will try to recover from the error
* CRITICAL means the Player will be unable to continue and must call
  load() again

Closes #564

Change-Id: Ie2c5468340c13e7a288b99690ab65b7ecc0a6b29
2017-04-04 23:57:59 +00:00
Joey Parrish 6cc3a6a9dd Dispatch network error when HEAD request fails
UNABLE_TO_GUESS_MANIFEST_TYPE doesn't indicate that the guesswork
failed due to a network error.  To make it clearer what went wrong,
dispatch the original network error from the HEAD request.

Change-Id: I1905afdf0913740f9fce0d011b6b2ac3ad37efd7
2016-09-26 18:56:35 +00:00
Andy Hochhaus 87a62d717e Add missing goog.require() dependencies 2016-06-25 15:45:15 -07:00
Jacob Trimble 5102f54120 Make Player.support synchronous and add support plugin system.
Now there is a new synchronous method Player.isBrowserSupported.  This
will detect basic support and return a boolean.  The support() method
has been renamed to probeSupport() and should only be used for
diagnostics.

Also added a plugin system to Player support testing.  Now a plugin
(e.g. offline) can add extra info to the output of probeSupport().

Closes #388
Closes #389

Change-Id: I313a41d9f123871272f1395aeb99c980df1f4bae
2016-06-02 21:57:38 +00:00
Jacob Trimble ad7b13e1e0 Fix bug in manifest parser helpers.
Change-Id: I506ebff70443a094a5e7d95f6b3cddf5d76eb5bd
2016-05-15 06:21:05 +00:00
Jacob Trimble acfb7c6d41 Moved code out of Player into utility files.
This moves a bunch of code out of Player into different files.  This
is needed to allow the new Storage class to have the same behavior
as Player.  This also reduces the size of player.js.

This moves the following code:
* Determining the manifest parser to use.
* Period filtering.
* Application track restrictions.
* Configuration object merging.
* Choosing initial stream sets.
* Track creation.

Change-Id: I84d68d39b487447d6f8d61a145cd034a88165739
2016-05-04 17:18:15 +00:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Joey Parrish 1daed906c0 Externalize manifest parsers and simplify factory
This properly externalizes manifest parsers so that they can be
implemented in application-space.  This also moves all parameters
from the factory function to start().

Change-Id: I66801bc1cb13214d576e0043cebc2d9b9cb5a641
2016-02-25 13:42:47 -08:00
Joey Parrish 2226269674 Add configure() to manifest parser
This simplifies the parser constructor and allows config updates after
playback has begun.

Change-Id: I43d53f2e074c1696a1f042961f399514b1afe5d6
2016-02-03 11:10:46 -08:00
Joey Parrish a6a150848e Player configuration
Change-Id: I43298c6bb86399fc10fbd5c201fed0902e0850fa
2016-02-02 18:41:19 -08:00
Jacob Trimble a7bd6991ba Add ContentProtection parsing to DASH parser.
Now, the DASH parser correctly parses ContentProtection elements
and creates the needed DRM info.

Change-Id: I41c4f24e983895f670fae948343400153525545c
2016-02-02 17:10:25 +00:00
Joey Parrish b822efcb86 Integrate Player with manifest parsers
Change-Id: I2388c8275a886709b35e7ec600fd6fa1340a6635
2016-01-16 05:10:48 +00:00
Jacob Trimble 54fa88f6f0 Added Dash manifest parser.
b/25851171

Change-Id: I4fbd6410d579899b749b50c8819fa8c17ac80658
2016-01-13 19:29:07 +00:00
Joey Parrish f2ca3a5b53 Move externally-used record types to externs
This is important to avoid renaming properties during compilation so
that applications can inject these types without compiling their code.

This also migrates record typedefs to the new documentation format.
Each record will be annotated with 'property' for each field in the
record.  This results in better output from jsdoc.

Change-Id: Ia877b1e2b333ef7020a85f16bc2469a20879bf94
2016-01-06 12:10:47 -08:00
Joey Parrish c9235f859c Add support-testing framework.
Support testing is hierarchical.  Player.support returns an object
mapping out the support present in various parts of the system.

This creates a shell for Player and DrmEngine, and introduces support
tests for MediaSourceEngine, ManifestParser, and DrmEngine.

This also adjusts the way support checks are done for text types, to
allow for expansion into MP4-embedded text types and other segmented
subtitle types.

Text changes related to #150 and #146

Change-Id: I707f01ba52cba6262ee89bee2c1f28d24aca4655
2015-12-10 20:00:22 +00:00
Jacob Trimble 5616a47c72 Added Manifest Parser interface.
b/25851171

Change-Id: Ib3f0df9107f81bcf1fa266a980bdf9b5c716210a
2015-12-07 18:11:45 +00:00