29 Aug, 2011
Embed a vimeo video using swfobject and setting the audio to mute
Posted by: Jennifer In: Javascript|Video
Not too much to explain here – wanted to embed a vimeo video, and wanted it to autoplay, but wanted the volume set to mute to start…
<div id="myvideo"></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript">
function vimeo_player_loaded() {
moogaloop3 = document.getElementById('myvideo');
moogaloop3.api_setVolume(0);
}
var flashvars = {
'clip_id': '29950141',
'server': 'vimeo.com',
'show_title': 0,
'show_byline': 0,
'show_portrait': 0,
'fullscreen': 0,
'autoplay': 1,
'js_api': 1,
'js_onload': 'vimeo_player_loaded'
}
var parObj = {
'swliveconnect':true,
'fullscreen': 1,
'allowscriptaccess': 'always',
'allowfullscreen':true
};
var attObj = {}
attObj.id="myvideo";
swfobject.embedSWF("http://www.vimeo.com/moogaloop.swf", "myvideo", "343", "193", "9.0.28", '',flashvars,parObj, attObj );
</script>
I actually just dropped this block right into a text widget in WordPress and it worked just fine…
The "29950141" is the video id (you can extract that from the URL you'd normally use to embed your vimeo video with)
The "343" and "193" are the width and height of the video we're displaying.