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
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
-
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
-
1most 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
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.