[wp-hackers] stopping an embedded video with javascript

Steve Taylor steve at sltaylor.co.uk
Wed Sep 11 16:59:12 UTC 2013


FYI, what I'm dealing with is a carousel with images and videos.
Ideally I would pause a video if it's playing as it's scrolled out of
view in the carousel.

> // Get element holding the video (embed or object)
> var player = document.getElementById("youtube_player");

I think this is what I'm looking for. But since wp_oembed_get()
outputs an iframe, I assume cross-domain stuff prevent me manipulating
the player? Do I need to do my own custom embedding to let me access
the API?


More information about the wp-hackers mailing list