This adds attach/detach methods to replace the media element in the
Player constructor. Now applications can take back control of the
media element or provide a reference later in the Player's life cycle.
This also allows applications to decide whether or not to set up
MediaSource in advance, through an optional argument on attach and
unload. The default will be to set up MediaSource in advance, which
maintains current behavior. This advanced setup of MediaSource can
improve load latency later.
This change also introduces async/await for the first time in the
project, which required changes to eslint config, Closure build
arguments, Babel & Babel-polyfill setup, and the esprima parser used
by our extern generator.
The use of async/await will improve readability in many places, and
these infrastructure changes to enable async/await should also unblock
issues #1336 and #1337.
Closes#1087
Change-Id: I0d6b4e0e2af27a6520a3d070fa92b7139b2cb8b0
The new release has a new parameter in runAll() which simplifies
flush().
At this point, we could technically do away with our flush() method
and call runAll(false) directly, but I find flush() more clearly
indicates to the reader what we are doing.
Change-Id: I90f105ff38d032e3c9caf5484d78824dc64fe43d
This feature is based on a forked version of jsdoc which we hope to
land https://github.com/jsdoc3/jsdoc/pull/1502 upstream.
Closes#1259
Change-Id: I48e07ffd8ae9fc2c07cd48b3e02b85e87694d341
This updates jsdoc to the latest version from npm and forks a copy of
the default jsdoc template.
In subsequent commits, we will reapply our customizations to the
template and to a jsdoc plugin.
This also fixes several bad annotations that the new jsdoc failed to
parse.
Issue #1259
Change-Id: I00a47270ea4754e1c96c43ca900d5cf889ab72e6
A bug in our Promise polyfill caused issues with the recently-added
AbortableOperation class on IE11. Since external polyfills for this
are smaller, it is easier to remove ours in favor of a third-party
polyfill. Applications that wish to support IE11 must now load this
additional polyfill.
We are using the "es6-promise-polyfill" module from npm, but any
compliant polyfill should suffice.
One feature our own polyfill offered was the ability to flush all
Promises, which allowed us to write synchronous unit tests that
simulated async processes. To get this ability back, we are now
using the "promise-mock" module in our tests.
Getting "promise-mock" to load correctly involved switching from
"requirejs" to "cajon", which builds on requirejs and supports
AMD modules more directly.
Closes#1260
Change-Id: I5de48e88a910736ae5c1897a7a509bc5641acb70
The eslint configuration is derived from analyzing the style of our
sources as they are now, plus a few tweaks.
In particular, we have disabled checks for undefined variables and use
of console, both of which the compiler handle with greater precision.
The compiler already knows what is defined in the environment through
our externs, and has specific exceptions for the use of console (demo,
tests).
We have also disabled a few checks that we should use, but will
require many changes to the code: no-unused-vars, no-redeclare,
and comma-dangle.
This commit also fixes several types of eslint errors that were easy:
- no-useless-escape (unneccessary escape characters in Regexp)
- no-constant-condition (using true/false/0/1/etc in if/while)
- no-fallthrough (caught an actual bug in one EME polyfill)
- no-irregular-whitespace (we had a UTF-8 nbsp in externs)
- no-cond-assign (using an assignment inside a conditional)
To satisfy stricter provide/require checks in the Closure Compiler
Linter, we will no longer use provide/require at all in tests. We
will still use provide in test utilities (test/test/util/) since it
sets up the namespace for us. But we will not use require there
because there is no deps management for test code.
Issue #1157
Change-Id: Icc44f51feeb568ea7d3980e693e92e560d897afd
Once we start moving to ES6, uncompiled mode stops working on non-ES6
browsers (IE11 is the only one we test on). We can disable uncompiled
mode in the demo, but we still want our tests to be uncompiled. With
uncompiled library & tests, we can test units that are not exported
and even access private members that would otherwise be renamed.
For production/demo, Babel plays no role. The Closure Compiler will
take in ES6 and spit out ES3 syntax (even older than ES5, so we can
at least run & fail a support check).
Babel will be used by Karma to preprocess all test and library code
before serving it from Karma. This will allow us to use ES6 in both
the library and the tests, and still run uncompiled tests and test the
uncompiled library on ES5 browsers such as IE 11.
Issue #1157
Change-Id: Idd185d0e231d16b6df52babda777111e85890012
This updates our jasmine-core dependency to the latest version.
In v2.8, some of the output from test failures is much more legible
than in v2.6.
Change-Id: I56ac0aa47fdd18ac57108c1e481ef9269269da51
Now that npm/node-which#51 is closed and the fix has been released in
which v1.3.0, we can simplify away the try/catch when we check for
available browsers.
Change-Id: If849299f75e5e4927756a1692ebe017dd5d80f34
Now we can snoop in the karma config and find a list of all usable
browser launchers. This allows us to provide hints for what browsers
could be used.
Change-Id: I7116eb72957c7f8b924380c26c4c66cdca50c0bc
This fixes an issue in which we released several builds (v2.1.3,
v2.0.4, and v2.0.3) with the wrong version number. This happens when
we build, then tag, then release.
By forcing a rebuild at publication time, we make sure the build we
release has the right tag in it.
Issue #869
Change-Id: I23867ceef43162469c53006336b7f0226dbe16b6
In jasmine-core v2.6.0, our DASH tests fail with "first.getUris is not
a function". The cause is unclear, but rolling back to jasmine-core
v2.5.x fixes the failures.
Change-Id: I5a2d8384d601677da9e8e16f6cfcab668c8b5117
The bulk of the logic for gap jumping is handled in Playhead. It
tracks the current buffered ranges and jumps over any gaps that appear.
It listens for a special browser event ('waiting') for when the video
element runs out of playable frames.
This change also removes the logic for jumping gaps at the beginning
of the timeline. This is handled by the more general gap jumping
logic and works cross-browser.
Finally, this updates the buffering logic to only count the amount of
content buffered (i.e. ignoring the gaps). This fixes some bugs where
gaps in the content can result in StreamingEngine buffering forever
since it thinks only a little is buffered.
This includes full implementation of the logic, but this doesn't close
the issue since there aren't any integration tests yet. Those will
be added next.
Issue #555
Change-Id: Id99eb9fe469e8cf2c7464a3d70c3733791e806e0
We were not able to get our externs generated by the Closure compiler.
There were many issues with the Closure-generated externs, including
the order of the externs and the replacement of record types and enums
with their underlying types.
We made a few attempts to patch the compiler, but could not get our
patches accepted upstream.
This change introduces a new script to generate our externs from
scratch. It uses a JavaScript parser called 'esprima'.
Some interfaces need to be exported to the generated externs, but are
not actually attached to the namespace by the compiler. For this, we
introduce a new annotation. These are the currently-supported export
annotations:
- @export: truly exported (attached to namespace) by the compiler
- @expose: truly exposed (not renamed) by the compiler
- @exportDoc: considered part of the exports in the docs
- @exportInterface: considered part of the exports in generated externs
These annotations are now documented in docs/design/export.md
Change-Id: I33bf7384889c14c9edb0fa5f11caa7c4f4d79af6
3rd-Eden/useragent#99 was merged and the changes were released in
version 2.1.11. We can now detect Chromecast devices in Karma.
Change-Id: I3d326d9ef82eb878d3a42c1d442543bb503b2ce7
This is better than ignoring all camelcase.
Introduced by yaniswang/HTMLHint#121 and released in 0.9.13.
However, 0.9.13 is incompatible with node v0.10. This was fixed
in yaniswang/HTMLHint#132, but there has not been a release since
(in 8 months).
Therefore we are pinning to today's git version instead of a release.
This gets us the camelcase whitelisting feature and doesn't break with
node v0.10.
Change-Id: I1e3b6c0c96ef24662b46497b1a601bde0dae5704
This adds a new option (--debug) to build/build.py which allows
building for debugging. This will expose all internal members on the
global |shaka| object and will not rename anything. This allows apps
to import the single compiled file but still perform debugging.
This also changes the file naming a little. Before, we would create
a |.debug.js| and |.debug.map| file when we compiled. However this
was not a debug file, it just linked to the source map. Now it will
always generate the source map and attach it to the compiled file. If
compiling with --debug it will add |.debug| to the file name.
This should also help with importing the debug library in ES6.
Issue #466
Change-Id: Ic51abbdb04763e8a3687c5d59a23d721436e1c7b
The latest htmlhint (v0.9.13) does not work with node v0.10, which
is what Ubuntu 14 LTS comes with.
See yaniswang/HTMLHint#132 for more details.
Change-Id: Ib148164828317ec56fa32ce3a7b21ae4061333f6
Still missing custom controls for live, but otherwise functional.
UI design and CSS based on work by Sam Dutton.
Change-Id: I0ee41254fb3b145822b018dff87aa583d6bef179
Tests all demo assets through the compiled library. To debug,
use --uncompiled to run them with the uncompiled library.
These new tests are off by default because they use external assets
and run very slowly. Use --external to run these tests.
Change-Id: If1648108dbb9a323d59f6b0e14b4fe6c446a90d2
This expands our list of browser targets using WebDriver and drops
the BrowserStack targets. We will no longer be using BrowserStack.
This also drops xvfb-run for Linux. As we move toward testing
primarily over WebDriver, the overhead of starting an Xvfb is not
necessary.
Change-Id: If2dd26caf3dea88ba39c20644f329451de48c273
By default, the tests will not print logging. With the argument
--enable-logging=level, it will output logging. |level| is a number
of the log level, or can be missing to use INFO.
Also, it will use the 'spec' reporter which will print each test that
is run. Logs are printed above the name of the test that caused them.
Change-Id: I697b0c1dd0b6648cddc79efa9c7a54da877d0303
This requires login information in the form of environment variables
BROWSER_STACK_USERNAME and BROWSER_STACK_ACCESS_KEY.
Change-Id: Iec52aa58da278dc9015e3d9d3cefa092e0b09af7
socket.io made recent breaking changes to their internals that
older versions of karma uses (See karma-runner/karma#1782).
The old bug with newer karma versions has disappeared and is
assumed fixed (See 817ea3d5).
Change-Id: Id1efa635de34f3d864c51c784b2343b8c9d9adee