[wp-hackers] stopping an embedded video with javascript
Nikola Nikolov
nikolov.tmw at gmail.com
Wed Sep 11 13:04:33 UTC 2013
Hi Steve. I've found out that usually the YouTube video will reload
itself(and stop unless it has autoplay) if it's visibility get's changed.
What I mean by this is that you can hide the video or one of it's
containing elements and show it again with jQuery(or other JavaScript), I
believe you can also change either z-index or the display CSS properties.
So if that's all you're looking for - I think you can try playing in this
direction, since it might be easier. Otherwise I'd look into the
documentation - can't help you with the JS API though :(
On Wed, Sep 11, 2013 at 2:56 PM, Chris McCoy <chris at lod.com> wrote:
> ive used jquery to do this, where i have a thumbnail and they click to
> play it.
>
>
> http://blog.pixelthemes.com/demo/load-yt-video-dynamically/
>
>
>
> On 2013-09-11 7:03 AM, "Steve Taylor" <steve at sltaylor.co.uk> wrote:
>
> >Hi folks,
> >
> >Does anyone know how to stop the playing of an embedded video (e.g.
> >YouTube) using JavaScript?
> >
> >I'm looking at the YT docs
> >(https://developers.google.com/youtube/player_parameters) and the WP
> >core source, but I'm having trouble finding how to target the actual
> >player object.
> >
> >I'm embedding the actual video programmatically, something like this:
> >
> >echo wp_oembed_get( $url . '&enablejsapi=1', array( 'width' => 500,
> >'height' => 362 ) );
> >
> >Any pointers welcome!
> >
> >Cheers,
> >
> >Steve
> >_______________________________________________
> >wp-hackers mailing list
> >wp-hackers at lists.automattic.com
> >http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list