Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The mediaSession coordinator explanation seems to be incorrect. #94

Open
MarkLyck opened this issue Aug 10, 2022 · 1 comment
Open

The mediaSession coordinator explanation seems to be incorrect. #94

MarkLyck opened this issue Aug 10, 2022 · 1 comment

Comments

@MarkLyck
Copy link

MarkLyck commented Aug 10, 2022

Hi.

I've been trying to implement SharePlay (Group Activities) on web using the mediaSession.coordinator feature. But the documentation here seems to be incorrect and I have had no success being able to implement it with the current documentation.

There's very little documentation out there on this feature in Safari. In fact I could only find 2 pieces of documentation and they both have errors.

  1. This explainer: https://github.com/WebKit/explainers/tree/main/MediaSessionCoordinator
  2. The WWDC from Apple on how to implement it: https://developer.apple.com/videos/play/wwdc2021/10189/ (contains coding errors and the solution didn't work at least for me)

Issues in the explainer:


1. mediaSession only exists on navigator

the explainer has examples accessing mediaSession on window or just on the "global" object like these:

window.mediaSession.coordinator.addEventListener('coordinatorstatechange', checkForCoordinatorState);
&
mediaSession.coordinator.state

But those are not valid ways to access the mediaSession in Safari? In Safari you have to do navigator.mediaSession to get the mediaSession.


2. There's no such thing as mediaSession.addActionHandler

the function navigator.mediaSession.addActionHandler does not exist on any browser.

I'm not sure if this is just a typo? But the real function is called mediaSession.setActionHandler


3. There's no settrack event?

This one I'm not sure about, but as far as I can tell from any of the admittedly extremely lackluster documentation, I have not seen anyone besides this repo mention a settrack event? and if I try to set it up, TypeScript complains it's not a valid event, and so far I have not been able to get it to fire anything.

Please elaborate on this.

TypeScript error:
Argument of type '"settrack"' is not assignable to parameter of type 'MediaSessionAction'


4. There's no explanation for getURLForTrackIdentifier ?

The documentation mentions: video.src = getURLForTrackIdentifier(getNextTrackItem()) twice.

But this function isn't explained, and of course it doesn't exist on either window. (window.getURLForTrackIdentifier) is not a thing.


It would also be really really appreciated providing an example repository of this feature actually working. Given the severe lack of documentation and that supporting SharePlay on web hasn't exactly been a popular feature to implement yet. It would be so helpful for many developers to have just a single working example to go from.

To back up my frustration with documentation, the only other piece of information I can find on mediaSession.coordinator online is this post on the Apple Developer Forums asking if anyone else got it to work, as of writing no one has responded with a success story.

https://developer.apple.com/forums/thread/699531

🙏 please improve the documentation for this. I'd really like to implement this feature.

@smfr
Copy link

smfr commented Nov 8, 2022

@jernoble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants