This was preventing the UI from seeing audio language changes in
native HLS on Safari.
Closes#1910
Change-Id: Ifc539528293fa30e28e09b67c2a83a23df9793ed
Previously, on seek, if any stream was unbuffered, it was considered an
unbuffered seek and every stream was cleared. This was to account for
the possibility that the streams would end up in different periods, and
therefore cause a hang.
However, this meant that changing the audio stream caused the video
stream to be flushed and reloaded pointlessly.
This changes the code to only clear all buffers if a stream has moved
into a different period; if one hasn't, it clears them on a case-by-case
basis.
Closes#1714
Change-Id: I6385e24266834bfc0c6dd2678facc5559affb941
At the moment, the storage manager does not support multiple concurrent
downloads. This modifies the demo to create a new storage instance every
time a storage operation is desired, then dispose of that instance after
the operation is complete.
This also refactors out the shaka-main-offline-changed event, which was
no longer necessary after allowing asset cards to re-load their buttons.
Issue #1432
Change-Id: I1312cf74a92f877279adb461e423a38e93bcfa0f
By listening to events on document in the capturing phase, we can
avoid complex event shims on HTMLVideoElement. By monitoring
global PiP state on the document, we can get rid of the getter and
setter for the document's PiP element, as well.
Follow-up on PR #1902
Change-Id: Ib5f5d0c7c735124a438901c5bb15e034ab10b996
If changes are deferred because of StreamingEngine state, the Player
should still fire variantchanged and textchanged events after the
changes are applied.
Also, clean up Player event firing patterns. The texttrackvisibility
and abrstatuschanged events should be fired asynchronously, just as
other state change events are.
The onEvent_ method was one line and only called from one place, so
it was inlined and removed.
The corresponding pattern of waiting on these events in the UI tests
was also changed.
b/131909906
Change-Id: I7f7d3b25ee336dbfe79c3214854722e1955acb6a
Safari on iOS does not support HTML5 fullscreen API. There
seems to be a (separate) way for a video element to enter
fullscreen mode. I will see if we can adopt it in a different CL.
For now, just hide the button if fullscreen API is not supported.
Issue #1909
Issue b/131923216
Change-Id: Ia30660c7a68fd626051fdf5abce59dbe993b2de2
This is only some of the warnings produced. These were not errors,
but we should fix them anyway so that we can adopt stricter settings
in future.
Change-Id: Ifd12f0e7c69f8f4b3d0d78b11794da2569a06d77
We get an error from ReadableStream when we abort a request. This
causes uncaught rejection error logs in Chrome. This ignores the
error and stops the logs.
Change-Id: I0f339e73564ac42b28ea8b7d0bf12ffb8c2ec9cc
With native HLS, we have a better, more accurate, and more timely way
to detect audio-only content. Use that whenever possible. This fixes
the audio-only poster and PiP element state with native HLS content.
Issue #997
Change-Id: Iee9f03deae6e56e7cfc140ed12278270eb667a41
It is type-safe to alias a class, but not one of its static methods.
Aliasing the method without the class makes it a "free call" to invoke
the aliased method.
A "free call" is when you call a method without the context of its
instance of class. There were several cases of this with static
methods.
This will be enforced by a future release of the compiler, which I
believe will lead into compiler support for "this" in static ES6
methods. In ES6, you can use "this" in static methods to refer to the
class and call other static methods. Closure compiler doesn't support
static "this" yet, but we will start using it as soon as it is
supported.
Change-Id: I4249db8b6dda9231ebba60ee0d4ad734a692c2fe
- Polyfill navigator.languages, which is missing on IE
- Add missing handler for uncaught exceptions (doesn't work on IE,
but is a good idea to have for debugging the demo app)
- Avoid offline setup if it's not supported (as on IE)
- Fix bad reference to uncompiled link (wrong ID)
- Log any caught errors to the console
- Wrap the init functions to catch and log any errors during init
Fixes b/131863587
Fixes#1911 (similar storage error on iOS)
Change-Id: Ib2a53392d5632c71825af17dd3e955cd54279e98
When the audio and text languages differ, we should display the captions
by default. This also happens if the app calls setTextTrackVisibility
before calling load. What happened is the text media state was being
created, but an update wasn't being scheduled. This meant the text
segments never got appended. This changes when the update gets
schedules. This also removes an unnecessary call to set the initial
state during startup.
Issue #1696Closes#1879
Change-Id: If3a1b9e2889fc0e487da0e7276ca837636bf2e54
The wrong loop index was used, which caused us to create bogus and
non-unique keys for a map, which in turn caused us to skip certain
variants that should have been created.
Fixes#1908
Change-Id: I6475acad16cd76acb81cd562ef033724c7c4ebaf
If the application developer specifies license servers, only those
should be used. Before this, a manifest-specified license server
for a certain key system could still be used if the application didn't
provide one.
Now, if there are _any_ license servers specified by the app, _no_
license servers will be used from the manifest. This is important
because it allows the application a clear way to indicate which DRM
systems should be used on platforms with multiple DRM systems.
The new order of preference for drmInfo:
1. Clear Key config, used for debugging, should override everything else.
(The application can still specify a clearkey license server.)
2. Application-configured servers, if any are present, should override
anything from the manifest. Nuance: if key system A is in the manifest
and key system B is in the player config, only B will be used, not A.
3. Manifest-provided license servers are only used if nothing else is
specified.
Introduced in #1644 to solve #484
Internal issue b/131264101
Closes#1905
Change-Id: I1a36a70044dc7bcc22681e3e4246d0a43d58e413
When the network becomes slow, we check if stopping the current request
and download the content with lower resolution is faster. If so, abort
the current request and start a new one.
Issue #1051
Change-Id: I588e524469432e362361d1cfbde6cd45c2009959
This is a complete replacement for the old demo page, made to be more
modern-looking and easier to maintain. It contains new features such as
remembering the URIs you provide for custom assets, and searching through
the default assets by feature.
This demo page is not quite ready for release yet, but it's getting close.
Change-Id: Iad01d1fc02c3cd238d73b9b9e02dbb4301cb6f2a
Range headers should not be sent when requesting the entire resource.
This fixes compatibility with Microsoft IIS web server.
Introduced in work on issue #1788
Change-Id: I151a2f15d4f5e95531e16d5372ee9a051135f12f
The unprefixed EME launched with macOS 10.14 (Mojave) rejects requests
for the key system IDs we know how to use. So until the bug we filed
against Apple is resolved, prefer the prefixed API.
Issue #382
Change-Id: I71313be2102af2da66a6389a9e9afdebd8ae033d
This adds a polyfill for Apple's prefixed EME implementation. This
will be used on all macOS versions prior to 10.14 (Mojave) and on
Safari versions prior to 12.1.
This also adds support for FairPlay license protocol eccentricities
in DrmEngine, so that the proper formatting is used for requests and
responses.
Issue #382
Change-Id: If1274d2f018a475f56c09df97645694f13acbde9
Track methods are now implemented for native HLS and other src=
playbacks. This will allow the UI to select text and audio languages.
This change adds best-effort methods to get track information for src=
playbacks, including native HLS on Safari. In many cases, it relies
on the audioTracks and videoTracks members of HTMLVideoElement which
are only implemented on Safari. They are in the spec, though, so
there's no harm in using them when they exist.
This is fully parallel to the manifest-based paradigm for MSE-based
playbacks. Each of these top-level methods in Player has an "if" to
decide which way to supply the requested info, except for the language
methods, which now delegate to the track methods.
With this, Safari's native HLS can supply audio and text language
information to the UI/app, and the UI/app can have some control over
those things through the tracks API. I believe this is important to
the success of our new iOS support.
Issue #997
Issue #382
Change-Id: Icc44a932927fafedda1b62a9d4c6e2ed3dc7db30
This fixes the definition of load() to wait for a frame before
resolving the load() Promise for src= playbacks. Now methods like
isAudioOnly can be trusted as soon as load() resolves.
This also allows load() to fail for src= playbacks if an error event
fires from the media element.
Issue #816
Issue #997
Change-Id: I0f6120d1334bbebcb78efdbbca65c7981f3ef265
This is a generic implementation that doesn't rely on the audioTracks
and videoTracks members currently only available on Safari.
Issue #997
Change-Id: I849845513efb2ee51205dcdca8568c889f1f7cdb
When listening to the same event on the same object from two places,
it's important that both listeners get called back.
This fixes EventManager's listenOnce() so that the unlisten() call
within listenOnce() doesn't remove both listeners at once. Now each
listener will be called before it is removed.
This bug is over two years old!
Change-Id: Id99f3a8e5ab80819921b30e28aa66d8a08b29e86
This event was added just for the sake of the UI tests, but the video
element's canplaythrough event works in its place.
Change-Id: I6774fdfdfbd2b197cc93eae743829510b61bb0fa
Allow indirect access to members (such as DRM engine, manifest, etc)
from Player methods as soon as they become available, instead of
waiting until the very end of the load process.
This fixes application access to several methods during the
"manifestparsed" event. The point of the "manifestparsed" event was
to allow early access to manifest and other metadata before streaming
begins.
This also lays the foundations for improvements in native HLS support
in those same methods, including the ability to get track information.
Issue #382
Issue #997
Fixes b/131604508
Change-Id: Ifee7b06fc2ccdcf5bcdf1c44f2f851d1d7e67fa1
In HLS, the CODECS attribute may contain duplicate of the same codec
with different profiles.
Closes#1817
Change-Id: I0d59c1ade6c8387a2e6b3ca00c0287e15c943ea3
Add a new function called getLoadMode that returns the current load mode
The possible responses are:
DESTROYED, NOT_LOADED, MEDIA_SOURCE and SRC_EQUALS
This function is necessary for #1003 because AirPlay only works with SRC_EQUALS mode,
and the AirPlay events fire even in MEDIA_SOURCE mode.
By fixing the definitions of isLive and seekRange for native HLS and
other src= playbacks, the UI for live streams with native HLS is now
working correctly on Safari.
Issue #382
Issue #997
Change-Id: I3d4f49ebe31a543c75f8607e7a194095ef198c0a
Based on experimental evidence, this fudge factor has been increased
from 50ms to 100ms. This is based on playback of the Art of Motion
HLS clip from Bitcodin, where the 50ms fudge was insufficient.
Without this, it goes into a buffering state at the end of the
content.
Issue #997
Change-Id: I7479705fd9e9359e70ab6ed3f24fd29dfdd7631e
Add event to notify listeners when abr is being enabled/disabled.
The resolutions menu is listening for variantchanged events to
update itself. It's possible, however, that just enabled abr
will pick the same variant that's currently being played, in
which case, there'll be no variantchanged event. The resolution,
though, still needs to update to reflect the fact that 'Auto'
resolution is selected now and not a specific one.
Adding an event for when the abr state changes helps solve
this.
Fixes b/131099397
Change-Id: I63b218d7423cd0d389dd540c5ed05966e00b861c
There is no reason to hard-code a value of 2 for this when we could
use a configurable value that the application will expect to have an
effect.
This has been tested with native HLS in desktop Safari.
Change-Id: I3833f2324cdd1419b1b6e9f93809e9239995c505
Commit 1284dd48, Change-Id: I8cad9bfde3309de7c2b8301b90aa8c40b6e4d247
introduced a change to the buffering logic. Instead of going into a
buffering state when less than 0.5 seconds of content was buffered,
the thredhold changed to one half of the configured rebufferingGoal.
Now the rule is one half of the rebufferingGoal or 0.5 seconds,
whichever is smaller. This accounts for unusually small
rebufferingGoal settings, while keeping a saner default behavior.
This change in behavior was one part of the test flake described
in internal bug report b/128923302. The other component to the test
flake was issue #1206, which still has a separate fix.
Issue #1206
Fixes b/128923302
Change-Id: I5f133959acac6fd4ebe7fed37d2df88892e6399e
Currently we check encrypt key tags after we parse the segment, so
playing an AES-128 encrypted content results in error message
'MANIFEST.HLS_COULD_NOT_PARSE_SEGMENT_START_TIME'. We should check the
encrypt key before, and give a more clear error message.
Filtering out the contents encrypted with AES-128, and if there's no
valid content left, we'll show 'CONTENT_UNSUPPORTED_BY_BROWSER'.
Closes#1838
Change-Id: I893f57a939e45f2787144dfe311b779aed26ac34
PlayRateController could get stuck in a state in which playbackRate
would be stuck at 0. It had to do with the order of modifiers
BUFFERING and ZERO_RATE. If they occurred in that order (BUFFERING
because of underflow, followed by ZERO_RATE because of a ratechange
event), then ZERO_RATE would stick.
In some cases (~10%) we would see this as a test failure in "Player
plays while changing languages with short Periods". In the demo app,
it could be easily reproduced by changing resolutions through the UI.
The solution is to remove ZERO_RATE, which doesn't seem to be useful.
Based on the comments in the code, this was to handle seeking in Edge,
where the browser sets playbackRate to 0 during a seek, then restores
it afterward. If that's the case, just ignore the ratechange event
to 0, and let the browser restore it afterwards. No need to track
that as far as I can tell.
With ZERO_RATE removed, it doesn't make sense to keep a BUFFERING
constant, so the whole set has been replaced with a boolean.
Broken in Change-Id: Id462cda2c5eb82c3713237341424b91891bd38ea
This bug did not affect any release or beta versions.
Closes#1886
b/130758100
Change-Id: I8c6455c3cdd7c9f353740425fb9337733908b2c9