-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
MediaSession not working with file URLs #25539
Comments
Can you provide further info here? Maybe an example code snippet of what doesn't work? It's not immediately clear to me what "MediaSession not working with file:// URLs" means. |
MediaSession is an API to show what music is currently playing; and to allow system-wide controls (e.g. on windows, using play/pause keys or when changing volume). A minimum example can be navigator.mediaSession.metadata = new MediaMetadata({
title: 'Test title',
artist: 'Test author',
album: 'Test album',
artwork: [
{ src: 'file:///home/dan/images/test.png', sizes: '96x96', type: 'image/png' },
]
}); When running this code, console will say that mediasession artwork can only be served via HTTP or HTTPS. |
Thanks for the extra detail, that makes sense, I just wasn't sure where the URL was being used with Unfortunately that check is baked into Chromium so it would require patching Chromium to relax that. It looks like |
Wouldn't that worsen the performance? It would mean I would have to load the full image and then pass it as argument |
I don't think it would have any worse performance than using a web server to serve the files. The image has to be loaded either way? Was merely pointing out a possible solution to your problem. |
Thanks for reporting this and helping to make Electron better! Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use. Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests. I'm adding the Thanks in advance! Your help is appreciated. |
isn't this comment enough? This is just the minimum example that should be run in browser context (you can also open any electron app with dev tools, run that in console and see the error). |
It just needs an image, which I'm not sure how to add to fiddle |
@danbulant If there's a runnable repro for an issue, a maintainer can verify it quickly. Without a runnable repro, it takes maintainers significant extra time to understand the steps needed to recreate the issue, and even then it's not clear whether or not we'll end up seeing the same behavior, because we may be running extra steps. It might not be much longer for us in some cases, but there are over 1,000 open issues on the tracker. An extra 5 minutes for every issue adds up. |
https://gist.github.com/Araxeus/8a6b97e88c815df0fc394e6f1828441d Change Pictures.zip |
@Araxeus which zip? Also, would it be possible to cut down the size of the repro a bit? I'm not sure we need all 200 lines of code included in that gist |
Sorry there was a problem uploading it, i updated the comment |
Alrighty. Looking into it, it seems like this check is quite deep within Blink: with no way for us to extend the allowed protocols. It does, however, support |
Preflight Checklist
Problem Description
MediaSession not working with file:// URLs
Proposed Solution
Allow use of file protocol URLs in mediaSession in electron
Additional Information
Creating a webserver just to serve the files for mediaSession feels unnecessary and an overkill for just a simple feature.
The text was updated successfully, but these errors were encountered: