hiding a video and muting the sound
I'm trying to hide an embedded video using som simple jQuery and it all worked fine till turned my speakers on. The video hides fine but the sound keeps on playing in the background.
Is there a function I can cal that either mutes the video aswell or completely removes it?
Check the link below for an example, play the video then click the hide 开发者_如何学Pythonvideo link to see what I'm talking about. Been at this for ages and it's properly annoying me now.
http://jsfiddle.net/P3zKc/
Well Vimeo's API reference is horrible, but check out this page. http://developer.vimeo.com/player/js-api Mainly the play()
and pause()
functions. It says you need to send any of these API functions indirectly to the iFrame containing the video. To do this you need to add api=1
to the iFrame url like this <iframe id="video2" src="http://player.vimeo.com/video/16965687?title=0&byline=0&portrait=0&api=1" width="400" height="225" frameborder="0"></iframe>
You can't call these functions directly on the iFrame though, you have to use postMessage()
to send the function call to the iFrame.
https://developer.mozilla.org/en/DOM/window.postMessage has some good documentation on the syntax of that function. Hope this helps.
Depends on what video player you are using. I know youtube has their own API. Would be able to give you more info but your fiddle doesn't want to load for me. Maybe make another if someone else has this issue, and I'd be glad to help.
精彩评论