YouTube Player API: How to get duration of a loaded/cued video without playing it?
I'm not able to get the correct video duration/length (in seconds) of a loaded/cued video via the getDuration() method of the YouTube Player API; the same method, however, returns a valid value once the video starts playing! Wondering how YouTube is able to show the valid duration of a loaded/cued video. When I load this HTML page with a 15 second video clip, I get the following debug output: state = 5 duration = -0.000025 When I hit the Play button, I get the following debug output: state = 3 duration = 15, Would greatly appreciate a solution or a workaround. Loading, and immediately playing