1
votes

Say I want to make a chrome extension that plays audio or video that you can play/pause. Extension page is being open from a popup. It should be available on any tab that you go to.

As I understand chrome limits you to the background page that is being run like a separate tab, but cannot be visible and a popup page that gets displayed once you click on the icon.

So I wanted to know how would you go on about it. Insofar I see it in hackish ways like:

  • background -> event -> popup (audio context + "fake" audio buffer player)
  • background -> localStorage -> popup (same thing)

Are there alternative solutions to this?

1

1 Answers

1
votes

Not really. If you want to run an audio independently of any open tab, you have to run it in the background page.

Then you can show any kind of UI, for instance in the popup, with your custom controls. Then, use Messaging to control the background page / update your controls in the UI.