0

I have a Chrome extension, which detects Youtube videos and gets their category via the Youtube API as follows:

background.js

chrome.webRequest.onBeforeRequest.addListener(function(details) {
    var PageInfo = new URL(url);
    if(PageInfo.host=="www.youtube.com")
       getCategory(PageInfo); //returns category number via the Youtube API

});

The problem I'm facing is that this does not work if Youtube is in full screen mode. For example after I load a video normally, I change to full screen and pick a video from the suggested videos after the initial one has finished playing. I then cannot get the extension to correctly pick up that new video.

Any tips would be appreciated. Thanks.

rok
  • 557
  • 4
  • 20
  • Maybe it's a problem with the youtube API. Can you provide a minimal extension to reproduce the issue? – wOxxOm Oct 24 '16 at 08:54
  • The API is not the problem. Let me rephrase - the extension event listener, which is supposed to pick up the URL, so I can get the video ID, does not fire at all. Basically what I need is the extension to fire an event when Youtube goes fullscreen mode. Currently the event above only fires when Youtube is not fullscreen. – rok Oct 24 '16 at 08:58
  • Well, there is a standard DOM event: `fullscreenchange`. Have you tried [`spfdone` event](https://stackoverflow.com/a/34100952)? – wOxxOm Oct 24 '16 at 09:10

0 Answers0