scriptygoddess

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.

1 Response to "Embed a vimeo video using swfobject and setting the audio to mute"

1 | sprashid

October 26th, 2011 at 4:19 pm

Avatar

great post! its workin just fine. if you add a line: loop=1
you have and looped video too. thanx

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements