[meta] Implement MediaSession API
Categories
(Core :: Audio/Video: Playback, enhancement, P3)
Tracking
()
Webcompat Priority | P3 |
People
(Reporter: baku, Assigned: chunmin)
References
(Depends on 6 open bugs, Blocks 1 open bug, )
Details
(4 keywords, Whiteboard: [webcompat:p3])
Attachments
(5 files, 6 obsolete files)
15.16 KB,
patch
|
Details | Diff | Splinter Review | |
22.93 KB,
patch
|
Details | Diff | Splinter Review | |
9.04 KB,
patch
|
Details | Diff | Splinter Review | |
30.03 KB,
patch
|
Details | Diff | Splinter Review | |
4.98 KB,
patch
|
Details | Diff | Splinter Review |
Updated•10 years ago
|
Reporter | ||
Comment 1•10 years ago
|
||
Reporter | ||
Updated•10 years ago
|
Reporter | ||
Comment 3•10 years ago
|
||
Comment 4•10 years ago
|
||
Comment 6•10 years ago
|
||
Comment 8•10 years ago
|
||
Comment 9•10 years ago
|
||
Updated•10 years ago
|
Comment 11•10 years ago
|
||
Reporter | ||
Comment 13•10 years ago
|
||
Reporter | ||
Updated•10 years ago
|
Comment 14•10 years ago
|
||
Comment 15•10 years ago
|
||
Comment 17•10 years ago
|
||
Reporter | ||
Comment 20•10 years ago
|
||
Comment 21•10 years ago
|
||
Comment 22•10 years ago
|
||
Comment 23•10 years ago
|
||
Comment 26•10 years ago
|
||
Comment 27•10 years ago
|
||
Comment 28•10 years ago
|
||
Comment 29•10 years ago
|
||
Comment 30•10 years ago
|
||
Comment 31•10 years ago
|
||
Comment 32•10 years ago
|
||
Comment 33•10 years ago
|
||
Comment 34•10 years ago
|
||
Comment 36•10 years ago
|
||
Comment 39•10 years ago
|
||
Comment 40•10 years ago
|
||
Comment 44•10 years ago
|
||
Comment 45•10 years ago
|
||
Comment 46•10 years ago
|
||
Updated•10 years ago
|
Reporter | ||
Updated•10 years ago
|
Reporter | ||
Updated•10 years ago
|
Reporter | ||
Updated•10 years ago
|
Reporter | ||
Updated•10 years ago
|
Reporter | ||
Updated•10 years ago
|
Reporter | ||
Comment 47•10 years ago
|
||
Reporter | ||
Comment 48•10 years ago
|
||
Reporter | ||
Comment 49•10 years ago
|
||
Reporter | ||
Comment 50•10 years ago
|
||
Reporter | ||
Comment 51•10 years ago
|
||
Reporter | ||
Comment 52•10 years ago
|
||
Comment 53•10 years ago
|
||
Comment 54•10 years ago
|
||
Reporter | ||
Comment 55•10 years ago
|
||
Updated•9 years ago
|
Updated•9 years ago
|
Updated•9 years ago
|
Updated•8 years ago
|
Comment 58•8 years ago
|
||
Comment 59•7 years ago
|
||
Comment 60•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
Comment 61•7 years ago
|
||
Comment 62•6 years ago
|
||
See bug 1547409. Migrating webcompat priority whiteboard tags to project flags.
Updated•6 years ago
|
Assignee | ||
Comment 63•5 years ago
|
||
Planning to implement a minimal version of the current media session API[0]. Fenix is the first target.
Assignee | ||
Comment 64•5 years ago
|
||
Assignee | ||
Comment 65•5 years ago
|
||
Depends on D45456
Assignee | ||
Comment 66•5 years ago
|
||
Depends on D45457
Assignee | ||
Comment 67•5 years ago
|
||
Depends on D45458
Assignee | ||
Comment 68•5 years ago
•
|
||
(In reply to C.M.Chang[:chunmin] from comment #67)
Created attachment 9091931 [details]
Bug 1112032 - P4: Correct MediaSessionActionDetails for seek operations.
In the current implementation, I have trouble to meet the following requirement:
Run handler with the details parameter set to:
- MediaSessionSeekActionDetails, if action is seekbackward or seekforward.
- MediaSessionSeekToActionDetails, if action is seekto.
- Otherwise, with MediaSessionActionDetails.
I cannot read the MediaSessionSeekToActionDetails.seekTime
from the MediaSessionActionHandler
's parameter when the callback/handler is for seekto
in the javascript test file. The following code demonstrates the problem specifically:
navigator.mediaSession.setActionHandler("seekto", function(details) {
console.log(details.action); // ok, it's "seekto".
console.log(details.seekTime); // undefined, but it's a `required` members in MediaSessionSeekToActionDetails
});
I guess the reason is because the type of details
is MediaSessionActionDetails
instead of MediaSessionSeekToActionDetails
.
I created a test-only function notifySeekToHandler
to trigger the handler for seekto
. notifySeekToHandler
will get a MediaSessionSeekToActionDetails
object form the caller and pass it directly to the handler. The handler type is MediaSessionActionHandler
, which is defined as void(MediaSessionActionDetails details)
. However, the parameter details
in the handler has no seekTime
member. I guess the reason is that details
is a MediaSessionActionDetails
instead of MediaSessionSeekToActionDetails
. Not sure if there is a way to make js realize the details
is actually a MediaSessionSeekToActionDetails
.
[Exposed=Window]
partial interface Navigator {
[SameObject] readonly attribute MediaSession mediaSession;
};
enum MediaSessionAction {
"play",
...
"seekto"
};
callback MediaSessionActionHandler = void(MediaSessionActionDetails details);
[Exposed=Window]
interface MediaSession {
...
void setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler);
...
// Test-only function to notify the `seekto` handler
[ChromeOnly]
void notifySeekToHandler(MediaSessionSeekToActionDetails details);
};
dictionary MediaSessionActionDetails {
required MediaSessionAction action;
};
dictionary MediaSessionSeekToActionDetails : MediaSessionActionDetails {
required double seekTime;
...
};
In general, I need to figure out how to make the following javascript code works:
let baseDict = { type: "base" };
let derivedDict = { type: "derived", num: 3.14 };
let foo = new Foo();
foo.setHandler("base",, function(dict) {
console.log(dict.type); // "base"
console.log(dict.num); // undefined
});
foo.setHandler("derived", function(dict) {
console.log(dict.type); // "derived"
console.log(dict.num); // 3.14
});
runHandlerForBase(baseDict);
runHandlerForDerived(derivedDict );
with the following WebIDL interface
enum Type {
"base",
"derived"
};
dictionary Base {
required Type type;
};
dictionary Derived : Base {
required double num;
};
// For "base", the `dict` is `Base`
// For "derived", the `dict` is `Derived`
callback Handler = void(Base dict);
interface Foo {
void setHandler(Type type, Handler handler);
void runHandlerForBase(Base dict);
void runHandlerForDerived(Derived dict);
}
Assignee | ||
Comment 69•5 years ago
|
||
(In reply to C.M.Chang[:chunmin] from comment #68)
In general, I need to figure out how to make the following javascript code works:
let baseDict = { type: "base" }; let derivedDict = { type: "derived", num: 3.14 }; let foo = new Foo(); foo.setHandler("base",, function(dict) { console.log(dict.type); // "base" console.log(dict.num); // undefined }); foo.setHandler("derived", function(dict) { console.log(dict.type); // "derived" console.log(dict.num); // 3.14 }); runHandlerForBase(baseDict); runHandlerForDerived(derivedDict );
with the following WebIDL interface
enum Type { "base", "derived" }; dictionary Base { required Type type; }; dictionary Derived : Base { required double num; }; // For "base", the `dict` is `Base` // For "derived", the `dict` is `Derived` callback Handler = void(Base dict); interface Foo { void setHandler(Type type, Handler handler); void runHandlerForBase(Base dict); void runHandlerForDerived(Derived dict); }
It seems there is no way to do that safely. One way is to define the Handler
by callback Handler = void(Object dict)
but accessing Object
directly will cause security issues because JS objects are hightly configurable.
Assignee | ||
Comment 70•5 years ago
|
||
(In reply to C.M.Chang[:chunmin] from comment #69)
It seems there is no way to do that safely. One way is to define the
Handler
bycallback Handler = void(Object dict)
but accessingObject
directly will cause security issues because JS objects are hightly configurable.
It might be fine since the dict
is created by browser itself. In real case, details
, whose type is MediaSessionActionDetails
, is created by the browser itself so it won't be a random value.
This problem seems to me a spec issue. I am going to file a spec issue and move the patches to another bug that only implement part of the operations without seek stuff. This bug will be used as a meta bug so subscribers can get the status update.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 71•5 years ago
|
||
Comment on attachment 9091928 [details]
Bug 1580602 - P1: Implement a dummy MediaSession interface.
Revision D45456 was moved to bug 1580602. Setting attachment 9091928 [details] to obsolete.
Comment 72•5 years ago
|
||
Comment on attachment 9091929 [details]
Bug 1580602 - P2: Implement MediaMetadata API.
Revision D45457 was moved to bug 1580602. Setting attachment 9091929 [details] to obsolete.
Comment 73•5 years ago
|
||
Comment on attachment 9091930 [details]
Bug 1580602 - P3: Implement setActionHandler API.
Revision D45458 was moved to bug 1580602. Setting attachment 9091930 [details] to obsolete.
Comment 74•5 years ago
|
||
Comment on attachment 9091931 [details]
Bug 1112032 - P4: Correct MediaSessionActionDetails for seek operations.
Revision D45459 was moved to bug 1580623. Setting attachment 9091931 [details] to obsolete.
Assignee | ||
Updated•5 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 75•4 years ago
|
||
We've shipped media session API on Fx82, close this bug.
Comment 76•4 years ago
|
||
We already documented this too: https://developer.mozilla.org/en-US/docs/Web/API/Media_Session_API
Description
•