开发者

hiding a video and muting the sound

开发者 https://www.devze.com 2023-03-30 11:14 出处:网络
I\'m trying to hide an embedded video using som simple jQuery and it all worked fine tillturned my speakers on. The video hides fine but the sound keeps on playing in the background.

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&amp;byline=0&amp;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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号