0

I'm making a Firefox extension to skip a video when a video starts to be played in a web page. I need to listen for when the function to start the video is executed. Any ideas on how to do this?

Cyphical
  • 1
  • 2
  • It depends on how and where that function is declared. The question is unanswerable without [MCVE](/help/mcve). BTW maybe you can just listen to the standard [DOM `play` event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play_event). – wOxxOm Jan 10 '21 at 08:33
  • Here's the most boiled down version of my question. I need my extension JS file to listen for when a function is called in a web page JS file. The function that needs to be listened to is globally accessible. – Cyphical Jan 10 '21 at 08:47
  • You can access the global context of the page via [wrappedJSObject + exportFunction](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts) in Firefox, [example](https://stackoverflow.com/a/64817357). – wOxxOm Jan 10 '21 at 09:07

0 Answers0