1

I am working on a music player extension for Opera browser. The idea is simple: select files from the local machine and play them in the sidebar. Thanks to the <audio> element, everything is working fine, while the sidebar panel is open.

I use the createObjectURL() method to pass the files to the <audio> element. The problem is that it only holds a reference to the files in the memory, which gets lost when the sidebar panel unloads. I can send these references to the background script, but it won't help.

Using a FileReader is not an option, because it uses a lot of CPU and RAM, and temporarily freezes the browser when I open the files. So I came up with the idea to use the createObjectURL() method in the background script, so the references would be alive while the browser itself is running.

Now the problem is that I can't open a file dialog from the background script. I can create a file type input, and also use the click() method, but the dialog window does not show up. However, the click event happens, because the onclick event listener is being called.

So I'd like to ask some help. Is it possible to open the file dialog from the background script at all? If it is, how can I make it work?

Nekomajin42
  • 638
  • 1
  • 6
  • 20
  • [Filesystem](http://www.html5rocks.com/en/tutorials/file/filesystem/) api? – Daniel Herr Jun 24 '16 at 20:07
  • @DanielHerr It seems it will never be a standard, and I'm affraid Chromium will drop support too. I'd like to use a permanent solution. – Nekomajin42 Jun 24 '16 at 20:57
  • 1
    No, Chromium won't drop support because it is used by [app](https://developer.chrome.com/apps/fileSystem) and [extension](https://developer.chrome.com/apps/runtime#method-getPackageDirectoryEntry) apis. – Daniel Herr Jun 24 '16 at 21:02
  • @DanielHerr I may be wrong, but it seems the HTML5 fileSystem API uses virtual locations, and the Chrome fileSystem API is not available to extensions. – Nekomajin42 Jun 24 '16 at 21:28

0 Answers0