Call into native Media Session browser API if available
ClosedPublic

Authored by broulik on Apr 22 2019, 8:49 AM.

Details

Summary

Since Chrome 73 it also supports Media Session also on the desktop.
The calls are re-arranged since setActionHandler throws if passed an invalid action and in this case we don't want to register the callback either.
Also, there's a new "skipad" action for a "Skip Ad" overlay in picture-in-picture mode [1] for which to work we need to call the native browser APIs.
Also, since MediaMetadata is a proper class and not an Object, iterate its prototype rather than just stringifying it and adjust our shim to do the same.

[1] https://www.chromestatus.com/feature/4749278882824192

Test Plan

Tried this example [1] in Chrome, now get a "Skip ad" button in the PIP overlay.
Firefox still works as before
Verified that setting null as metadata still works (not regress Bug 401636)

[1] https://googlechrome.github.io/samples/picture-in-picture/skip-ad.html

Diff Detail

Repository
R856 Plasma Browser Integration
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik created this revision.Apr 22 2019, 8:49 AM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 22 2019, 8:49 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Apr 22 2019, 8:49 AM
broulik edited the test plan for this revision. (Show Details)Apr 22 2019, 8:55 AM
fvogt added inline comments.Apr 22 2019, 9:13 AM
extension/content-script.js
608

Why a function instead of an object now?

broulik updated this revision to Diff 56731.Apr 22 2019, 11:48 AM
fvogt accepted this revision.Apr 22 2019, 7:27 PM
This revision is now accepted and ready to land.Apr 22 2019, 7:27 PM
This revision was automatically updated to reflect the committed changes.