Jellyfin-web: Copy Stream URL not working with Firefox

Created on 31 Oct 2019  Â·  7Comments  Â·  Source: jellyfin/jellyfin-web

Describe the bug

With firefox, the Javascript bit that is writing to the clipboard is blocked with this error:
document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler.

To Reproduce

  1. Use Firefox
  2. Click on any media menu
  3. Click on "Copy Steam URL"

Expected behavior

URL should be written to the clipboard

System (please complete the following information):

  • OS: NixOS
  • Browser: Firefox
  • Jellyfin Version: 10.4.0
bug confirmed

Most helpful comment

10.5.0

All 7 comments

This is probably because the click event is not set on the "copy" button, firefox blocks the copy action if that is the case. This mdn link explains it

Same on Chrome on Android.

Real pity since it's the only way to get media to play on an external player on Android.

I've looked into it and there may be four different solutions:

  • Executing the current method from the click handler, but I'm not too familiar with this project and seeing how it's currently done, I guess it may not be the solution.
  • Using the Clipboard API, but it needs user permissions and FF (at least) doesn't pass them to the user when in HTTP (still may be better than nothing). After further tests, I can't seem to make the permissions 'clipboardWrite' or 'clipboard-write' work on FF, even in HTTPS. Same limitations as the current method, with the added constraints of needed a secure environment.
  • Using a 3rd party plugin, but I'm not sure what the stand here is about it. Moreover, they surely use either the deprecated method or the new API, and though we will hit the same problem.
  • Keep the current command and if it fails, display an alert or something to let the user copy the URL by itself. Displays the URL somewhere for the user to copy.

I'm pretty new to contributing to a big project and I'd like your advice on it.

Moreover, the current implementation uses a try / catch to check if the copy succeeded, but the command returns true or false whether it worked. A fix for this has been pushed and merged.

A workaround has been pushed to master to allow manually copying the URL #754, maybe we should close this issue?

What version of jellyfin will have this fixed?

10.5.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hamburglar2160 picture hamburglar2160  Â·  5Comments

Redsandro picture Redsandro  Â·  7Comments

mitchelljfranklin picture mitchelljfranklin  Â·  4Comments

majora2007 picture majora2007  Â·  3Comments

MrTimscampi picture MrTimscampi  Â·  4Comments