salvadordf/CEF4Delphi

Is there object / event for listening Media Session API?

dibok opened this issue · 2 comments

dibok commented

Web pages can expose Media Session API, it is using for lock screens notifications and also for changing playing status directly on the page

https://developer.mozilla.org/en-US/docs/Web/API/Media_Session_API

You can see what I mean by playing youtube video on Fire Fox or Chromium based browser and in console run:

navigator.mediaSession.metadata

Is there any posibility to retrieve such data in TChromium?

As far as I know, CEF doesn't expose any Media Session method or callback directly.

I haven't used that API but if it's supported by CEF the you should be able to inject some JavaScript code that sends the information you require to your application. See the DOMVisitor and the JSExtension demos to know how to send information between the browser and Delphi/Lazarus.

If a browser in normal mode doesn't support the Media Session API perhaps it's supported in the "Chrome runtime" mode. Try the MiniBrowser, TinyBrowser or TinyBrowser2 demos.

Remember that there are some media related methods in the DevTools : WebAudio and Media

The CEF project maintainer will give you more details about the Media Session API support in CEF. You can post this question in his forum.

dibok commented

Thank you very much. I'll take a look