In the DASH parser, if there was no suggestedPresentationDelay and
ignoreMinBufferTime was set to true, the parser would set the
presentationDelay to NaN. This was because Math.max() will return NaN
if undefined is passed into it.
This changes minBufferTime to default to 0, if ignoreMinBufferTime is
true.
Fixes#2015
Change-Id: I8fc61706a04d14fd729e2185ce993a8bc87e48e5
Previously, in uncompiled mode, we were loading Shaka Player using
goog.require calls, but loading the demo code directly. This meant that
the demo code was loaded before the Shaka Player, code, which lead to
issues if something needed the "shaka" namespace to exist during
load-time; for example, if a demo class wanted to extend a Shaka class.
This adds goog.provide calls to the demo, so that it can be loaded with
goog.require also while in uncompiled mode.
Change-Id: If6cc92db0ce05dd9c3f298e9bd1a5119452ad8a4
This fixes a TODO and fixes setting the "active" track when switching
languages when not displaying text.
Fixes#2010
Change-Id: Ic4cf4126ffb9b93a09af998e20f9da0e7af852fb
This is a helper to aid in iterating over items. This returns a list
of objects that contain:
- "item": The current value.
- "prev": The previous value in the list.
- "next": The next value in the list.
- "i": The zero-based index in the list.
Issue #1518
Change-Id: Id18ab977e3ae45dfbfd2b4137a1bffb6e53c6bce
This ensures that we get the expected types and that type coercion
doesn't convert between types. This also ensures we are consistent
in how we check for equality of primitives in tests.
Change-Id: I9f3aacdf25ab1afe5e8d6e4b895b5299ee687d54
Instead of checking each property separately, just use
jasmine.objectContaining. This also adds a utility for matching a
number that is close to an expected value. This is required when
matching objects with toEqual().
Change-Id: I4de49cfaf254e0752beffc97c578a77f9ec8ee95
This error wasn't caught before, but was fixed in a recent CL. This
adds a test to ensure we don't regress later.
Change-Id: I10e72303c39de82bb9a1f7cb4a6b171c46fdbecd
This enables custom buttons that aren't part of the
library to be used in compiled mode.
Closes#2011
Change-Id: I500f93a86bfd2893948e594a969b6f8208836251
We start streaming text once subtitles have been enabled.
With external text, we used to create a media state for it
as soon as text was added even if captions were disabled
and we did not actually stream, although no text was
being parsed and shown.
This lead to the following problem:
If external text was added with subtitles disabled, we
created the media state with no actual cues in it.
Once the subtitles were enabled, we saw that a media
state existed for text and assumed it had content.
So, we started streaming, but nothing was shown.
This change makes us only create the media state if
subtitles are enabled and defer creation otherwise.
Closes#1938.
Change-Id: Iee39c30fbd6b7f0abe7772dfb75cba561fcc9998
This changes several classes to use the Destroyer class to handle
destroy(). This also changes the behavior to not ignore destruction
and instead throw a new error. This is more clear for callers and
ensures we propagate errors.
Change-Id: I756c085639558509c22e5c43d69ddf4acd28d46f
This converts them to be normal async tests instead of mocking the
clock and Promises. This uses some internals on the DASH parser for
updates to allow the tests to complete quickly.
Issue #1379
Issue #1953
Change-Id: I6d21d124a290920e568b8a275221140e1b27941b
When switch() is called, it checks for what segment/period the media
state will need to fetch next. As text is much smaller than audio/
video, it might be the case that text has all the segments in
period i while audio and video are still in the process of fetching
them.
Thus, the next period needed for text will be i+1, while for other
media states it will be i.
Switch() assumes that if the period needed is not the same as
current period, a perios transition is about to happen and there's
no point in switching streams now since they're about to change on
the next update anyway.
However, the period transition only happenes if all the media
states require it. In our edge case, only text is ready for the
next period, so transition will not happen.
This change corrects the assumption "if a media state is ready
for the new period, don't switch" to assumption "if ALL media
states are ready for the new period, don't switch."
Issue #1774
Change-Id: I35f1b7ae10704922fb5692e02fc5f2edc6982575
We can calculate the index of the highest bit set using log() instead
of looping and using bit math.
Change-Id: I6ff9af600cb17ea83398ce6fbbcb84982a789653
Apparently calling play() causes the playbackRate to be set back to 1,
so we need to call play() before setting the rate.
Fixes: 135520981
Change-Id: Ibea1cbd7c0ee4605b10b0fee87a8b5c069e04fa3
This ensures you spell the browsers correctly when excluding browsers
instead of silently ignoring badly spelled browsers.
Change-Id: I039c4a418f0e716d54daa195588890f37af3bb7a
The previous fix only fixed uncompiled mode, it turns out.
The actual root problem was a namespace collision in the build
script for the receiver app, which lead to the player namespace
being over-ridden by just debug/log.js.
This fixes the build script to just not include debug/log.js. The
receiver app wasn't using that file anyway.
Change-Id: I290a6a9051c86c816614afe3922d2c82bf8cbfa5
If a value given to player.trickPlay() is outside of what
the browsers accepts for video.playbackRate, fall back
to fast forward by seeking, same as we do for rewind.
Closes#1957.
Change-Id: I12275377b70dc1d0e2ece7f5647e6590f0304cf5
Instead of using a hard-coded chunk size when creating large strings,
this now uses a browser check to detect it. This allows us to use
large chunk sizes on browsers that support it but still support low-end
devices.
Closes#1985Closes#1994
Change-Id: Ibe45902b659516ae66bd7da33007fd15e7f64207
A recent push to promise-polyfill (used by our promise-mock) caused
errors in our tests. This blacklists the new release until they
release a fix.
See taylorhakes/promise-polyfill#103
Change-Id: I65784e393143a21769c0a40e3f8b93cf189f7e8d
There was a fairly unimportant assert on demo assets that was, for
whatever reason, causing problems on Chromecast.
Specifically, assets are created very early in the load process, early
enough that the asserts module might not have been loaded yet.
Normally goog.require would ensure that is not a problem, but it does
not seem to be helping.
In any case, this just removes that assert.
Change-Id: I9d3bfcdb4fc87df0dec2b167eaef768df6f81d89
- Reduce times for "short delays".
- Remove backoff delay from networking tests.
- Avoid hard-coding delays in the library.
- Move Storage tests to integration tests since they use indexedDB (and
take over 200ms each to run).
This reduces the time it takes to run unit tests (with --quick) from
50 seconds to about 6 seconds. Now all but one unit test finish <100ms.
Change-Id: I88461472a87c4cf750a36d07d07422818e069a4d
In my previous fix, I misread the Cast SDK docs and read this field
from the wrong part of the message. I did not (and still do not) have
any way to test this feature request from @bojant987. My mistake was
pointed out to me in this comment:
https://github.com/google/shaka-player/commit/bc91f6c9#r33913938Closes#1989
Change-Id: I97bff23faae897e08fc270a7aa694ddf48076080
Now if the build scripts change, the auto-detection for changed files
will force the library to be rebuilt. This allows detecting changes to
the build script when determining if there are changes.
Change-Id: Ibf4fc3fb2197ae5993c9acd7adb65c88e205b6f4
One of the ending comments seems to have gone away during a refactor.
This adds it back, and cleans up all the blocks with useful comments.
Change-Id: I29d093255805d806bb9957896ed348b0fdf8649e
A recent refactoring caused a test failure on Chrome due to a Promise
getting rejected without a "catch" block and getting an unexpected
rejection error. This adds the expectation first so we don't get that
error.
This also removes the empty "catch" blocks since we use async/await,
which introduces another Promise, so the "catch" block won't suppress
the unhandled rejections like we want.
Change-Id: Ib217b4b374668d800a0eeb1a9b8069269bccf261
The StatusPromise isn't needed when just checking for resolve/reject;
we can use await or expectAsync for that. So this removes the usages
of StatusPromise that only check for resolve/reject.
This also renames the destroy() variables to "d" to make them different
from the operational promises.
Change-Id: I48e807d84e56ee28b7489c572570e11e6325a4ed
This change splits ui tests into general tests and customization.
This is a base for adding more customization tests and creating a
suit for a11y tests.
Change-Id: Icd293ac382ec4a14e15b5be57bf194f83e45f89d
This add a filterDescribe that can be used to filter groups of tests
based on platform support. This consolidates the different test
filtering to one place.
Change-Id: I8f320fcf0edfa2d984433890fcfc3714e78b195b