Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
44
rated 0 times [  47] [ 3]  / answers: 1 / hits: 78988  / 13 Years ago, sun, august 7, 2011, 12:00:00

I am writing a Browser Plugin and need to find a way to get the current time a YouTube Video playing on YouTube using JavaScript. I have been playing around in the Chrome JavaScript Console and haven't had any luck.



It appears that the chrome API only works with embedded video players not a video that is playing on on youtube.com. One option I looked into is in the share section of a video their is an input box for the start at: time that contains the current time of the video. I have tried using .value and .text on this input box and they both return undefined? Does anyone have any ideas?


More From » youtube

 Answers
3
ytplayer = document.getElementById("movie_player");
ytplayer.getCurrentTime();

See the api


Update: if it didn't work, also try player.playerInfo.currentTime (codepen live example)


[#90770] Friday, August 5, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dantel

Total Points: 7
Total Questions: 102
Total Answers: 97

Location: Saint Lucia
Member since Sat, Jun 6, 2020
4 Years ago
dantel questions
;