0

i wanted to ask a question regarding this chrome extension called Turn Off The Lights , im aware of how to dim the background using jquery and css etc.. but what i am interested in knowing is how to get the current video playing from popular websites like YouTube, dailymotion etc.. before applying the jquery effects..?

2 Answers 2

1

search with javascript to this "movie_player" id (YouTube only) and check if it's playing, if yes -> dim the web page.

More information about detecting the video player status, see this API link: https://developers.google.com/youtube/js_api_reference#Playback_controls

2
  • Thanks for the help, but what if i want only one piece of code to access the currently playing video on any video sharing website? Aug 31, 2013 at 12:14
  • 1
    most video sites are using HTML5 video, and that is the same technique as the youtube API. Just get the ID of the <video> element. Aug 31, 2013 at 13:32
0

I can only assume that it looks for or elements in the page using some selector.

Then it would add the div to dim the background using a content script, changing the z-index of the found video element to a higher value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.