Commit Graph

40 Commits

Author SHA1 Message Date
Joey Parrish d08531cf9a fix(Tizen): Fix exceptions thrown from logging methods (#5063)
PR #5050 unboxed the console log methods, which broke logging on Tizen.
This change was never released.

This fixes the issue by using arrow functions to prevent unboxing.
2023-03-07 09:34:39 -08:00
theodab 694497684c fix(logging): Simplify log code. (#5050)
This removes some workarounds that were in the logging code for the sake
of Internet Explorer. We no longer support IE, so those workarounds are
no longer necessary.

Closes #5032
2023-03-02 21:50:57 -08: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
Joey Parrish 926900e97f Mark ads as beta and getManifest() as unstable
Change-Id: I7b7c21e07c0b4d9ada2a3eefe2b83b735152452b
2020-06-01 15:57:24 -07:00
Joey Parrish 48749210b0 Fix shaka.log in debug builds
This fixes the missing shaka.log in debug builds by exporting it
explicitly with the Closure Library API if goog.DEBUG is set.

Closes #2565

Change-Id: I4edd3220997f890058b693cec3bdf295ab5c171c
2020-05-19 18:41:29 +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
Jacob Trimble 260e485cbe Use bind() with console methods.
We avoided bind() since we could use lambdas instead; but with the
console methods, we loose the link to where the log happened in the
DevTools.  So by using bind(), we can see where the log came from.

Change-Id: I04ad1f360e459c3676eabb6d0651a7963d186b43
2019-10-01 17:47:36 +00:00
Joey Parrish 0b2b8e3f02 Eliminate goog.define
Changes in the Closure Compiler have made it so that goog.define
without using and assigning the return value will no longer be
allowed.  There is no need for goog.define, though.  Instead, we can
just use the @define annotation and assign directly to a variable.
This eliminates the use of goog.define.

A similar change was already made almost two years ago for the Player
version in lib/player.js
(in Change-Id: Iad9040d0f5ee397c7d46b1d64bc5bebf2def57bc)

Replaces PR #2158

Change-Id: Ia7c7de0407f9790284c418fb6edde948b922ab62
2019-09-25 21:52:15 +00:00
Jacob Trimble ab6d06320e Convert debug files to ES6.
Issue #1157

Change-Id: I11bae98bcfff812589f69f38d446e655776eadc8
2019-05-31 17:49:49 +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
Aaron Vaage 5cad6be056 Add log.alwaysError
Added an alwaysError log method that will ensure that some errors
(like expired deprecation messages) are always printed.

Change-Id: Ia641f97b97258ea2826a1ad3fe2d7d7952ffa2ed
2018-12-04 17:24:54 +00:00
Jacob Trimble 17955c1a00 Add some hints for when to use log levels.
Change-Id: I9923003cb1db3aff3f648cb788783a5a9223654b
2018-09-21 22:41:15 +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 f70436540c Convert 'var' to 'let'/'const' (3 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: I10f5c38a8b06b5797c6eec7492829084114514c9
2018-02-14 00:47:03 +00:00
Jacob Trimble a2df5327c1 Add a method to allow logging in compiled mode.
We want to be able to write logs for deprecated APIs.  This ensures
that those logs appear even when we disable logging in compiled builds.

Change-Id: I1f1546049fb17967eedb1bb45a7f76d5b1809cd1
2017-10-27 23:07:23 +00:00
Jacob Trimble 1224464535 Use goog.DEBUG over COMPILED.
This allows including the extra assertions and logging in the debug
compiled library.

Change-Id: Ie8575a31b428e1985077939169bfae9254e395d5
2017-09-27 11:24:32 -07:00
Joey Parrish 4d5e668583 Expand player stats and track metadata
Visible changes:
 - Add loadLatency stat
 - Add mimeType to tracks
 - Track state changes (buffering, playing, paused, ended)

Internal changes:
 - Track switchHistory, playTime, bufferingTime in private Stats struct
 - Remove dead timer code

Change-Id: I4566373251b9876b0d4f762a9d77aa50aea8ed00
2017-01-20 22:54:05 +00:00
Jacob Trimble 1749bb6626 Output enum values in jsdoc.
Now the generated documentation will include the values of enums, not
just the names.  This also adds documentation for shaka.log.

Closes #337

Change-Id: Ie45a5f5df8d173e5a4ba08a1807d918c22d5497c
2016-04-19 13:26:52 -07:00
Joey Parrish bda33cc9b6 Demo app v2
Still missing custom controls for live, but otherwise functional.

UI design and CSS based on work by Sam Dutton.

Change-Id: I0ee41254fb3b145822b018dff87aa583d6bef179
2016-03-30 00:36:32 +00:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Jacob Trimble 8daf53e329 Renamed shaka.asserts to goog.asserts.
Using goog.asserts will work with the compiler.  So rather than
simply casting a nullable value when passing to a method, we can use
an assert which will correct the type and print a log if it somehow
is null.

This is not the same goog.asserts found in closure library, this
simply calls console.assert, but it is not required to do anything
for the compiler help.

Change-Id: I2548e39e772f0aa7ec41437cf9f5a2be383e0fbd
2016-03-11 15:29:20 -08:00
Jacob Trimble 846e7beb48 Unified comment spacing.
Before there were two style to indent comments after an annotation,
using 2 and 4 spaces.  Now this only uses 2 spaces.

Change-Id: Id06415d7193cc154a2768fb3932aff7a06b7ed32
2016-03-10 16:27:45 -08:00
Joey Parrish a306f6ffd6 Fix default log level in uncompiled build
Change-Id: I063761f8d3b86a4305588f00d6216a37ed11fa5b
2016-02-11 16:40:02 -08:00
Joey Parrish 3bb8f06b7d Require assertion messages
This will enforce messages on assertions, which should make console
logs more useful.

Change-Id: I2cff9e20f630d1d4d46192e2ee317b1942cc7188
2016-01-08 13:29:56 -08:00
Joey Parrish 3e7014db2b Fix library load and polyfill for old browsers
This will allow support-testing to work on older browsers so that
application developers can still load the library and query for
support to show an appropriate error message.

To accomplish this, we avoid load-time uses of Function.bind, avoid
certain polyfills if modern types are not available, and compile down
to ES3 to avoid errors caused by use of the reserved word "catch" on
Promises.

This has been tested back to IE6, Safari 5.1, iOS 6.0, Firefox 6,
Chrome 15, and Opera 16.

Change-Id: I9deed106a7736758e04452ef85bae40f37c6fe62
2015-12-10 10:49:45 -08:00
Joey Parrish 4cc4e96dbd Overhaul license comments and file annotations
* Updates all Copyright years to 2015.
* Adds licenses annotations to all JS.
* Makes all licenses identical to avoid repeated appearance in the
  compiled output.
* Drops fileoverview annotations, which do not affect docs output.
* The linter still requires fileoverview on externs.

This patch required a newer closure compiler, since the previous
version we used had a bug regarding license annotations that caused
the license comment block to appear in the output once per file
regardless of uniqueness.

Change-Id: I2e9272db680cba7ecc4613d97f1d3a94ac2244cc
2015-09-08 12:02:34 -07:00
Joey Parrish 4d9177240a Revert "Adding license annotation to js files."
This reverts commit 8cb24652cb, due to
the fact that the new annotations caused our binary size to jump
by 52%.

The compiler preserves all 'unique' licenses, which causes trouble
since the comment blocks with the license annotations are not unique
and contain file overview comments as well.

We can re-examine this once we have restructured the license headers.

Change-Id: I418e407a0e0253630633697f30cf496a7fc2ddfc
2015-09-04 18:36:39 -07:00
Yohann Connell 8cb24652cb Adding license annotation to js files.
Change-Id: Id10592ccaf35608ac4f01844cae2fec4a2030d65
2015-09-04 00:05:17 +00:00
Joey Parrish 0089fdb594 Update the Closure Compiler
* Update compiler to v20150609.
* Since v20150315:
  * Promise.prototype.catch externs now provided by compiler.
  * Iterator externs now provided by compiler.
  * Variadic function syntax has changed.
* Since v20150505:
  * BufferSource extern now provided by compiler.
* Since v20150609:
  * VideoPlaybackQuality extern now provided by compiler.

b/21559591

Change-Id: Ie7d030422e132879e28b1bdf538991a27ebc25df
2015-07-14 03:30:34 +00:00
Thomas Stephens 0f914cf953 Removing unnecessary @type annotation 2015-06-26 10:23:10 -05:00
Thomas Stephens 2c7196ca07 Removing unnecessary @type annotation 2015-06-26 09:13:54 -05:00
Thomas Stephens 5abe5b59df Adding missing docs and type annotations 2015-06-25 09:23:20 -05:00
Thomas Stephens 6a235a107e Code review comments 2015-06-24 22:08:14 -05:00
Thomas Stephens 4e14ff8a6f Code review comments 2015-06-19 11:27:18 -05:00
Thomas Stephens b0a8017866 Style fixes 2015-06-19 09:50:12 -05:00
Thomas Stephens 2ed347862e Patching console.assert when it does not exist, or when bind is not implemented on it (IE 9 with F12 Developer Tools open) 2015-06-18 16:47:29 -05:00
Thomas Stephens ec623c6d38 Patching console logging functions when they do not exist, or when bind is not implemented on them (IE 9 with F12 Developer Tools open) 2015-06-18 16:47:09 -05:00
Thomas Stephens b1baaaf33c IE 9 has window.performance, but not window.performance.now, so explicitly checking for it 2015-06-18 16:18:19 -05:00
Joey Parrish fa931883f7 Minor clean-up in Stream.
Use Stream.BUFFER_SIZE_SECONDS_ on startup.
Improved the way adaptation latency is measured.
Avoid calling abort() twice during adaptation.
Reduce the size of the Promise chain slightly.
Merge the SPLICING state into SWITCHING.

Change-Id: Ie06e6c56df4df17e7acb379d0e19f639f791c99b
2015-04-09 18:52:05 +00:00
Joey Parrish b3d035be9f Shaka Player release v1.0 2014-12-19 14:26:19 -08:00