So, as I said in my first reply, setting autoplay parameters is nothing to do directly with SWFObject. You need to set whatever value your video player swf is expecting in your Flashvars in order to set the autoplay.
What video player are you using? Aran On Wed, Feb 10, 2010 at 2:47 PM, Amit <[email protected]> wrote: > Hi, > > I am using SWFObject v2.2 <http://code.google.com/p/swfobject/> to > play swf/flv files. > > I have tried two different SWFObject files to auto-play same .flv > file. Auto-play is not working in case of "SWFObject V2.2 <http:// > code.google.com/p/swfobject/>" but it worked when I used "SWFObject > v1.4.4: Flash Player detection and embed - > http://blog.deconcept.com/swfobject/" > > I can not use "SWFObject v1.4.4" because there is lot of dependency on > the version (SWFObject v2.2) that I am using right now. Please check > the following page to see my problem : > > http://www.merck.com/research/discovery-and-development/home.html > > There is one video image on the right side panel. Player will be > loaded when you click on this image. I want to make it auto-play > whenever user clicked on this image. > > Here is my method that I have used- > > Site.MediaPlayer = { > // minimum required flash version > FlashVersionRequired : '9.0.0.0', > // url of the main flash movie > PlayerSwfURL : '/includes/audio-video/mediaPlayer/ > Main.swf', > flashSupported : false, > // default flashvars params > ParamObjDefaults : { > fontsURL : '/includes/audio-video/mediaPlayer/swf/ > fonts.swf', > stylesURL : '/includes/audio-video/mediaPlayer/css/ > mpstyles.css', > playlistURL : '', > skinURL : '', > mediaURL : '', > mediaType : '', > audio : '', > videoimg : '', > overlay : '' > }, > // basic movie loading/creation function > Load : function(paramObj, targetElement) { > // merge defaults with override value. > var playerParams = {}; > for (var i in Site.MediaPlayer.ParamObjDefaults) { > var defaultName = i; > var defaultValue = > Site.MediaPlayer.ParamObjDefaults[i]; > var setValue = paramObj[defaultName]; > var mergedValue = (setValue != undefined) ? > setValue : defaultValue; > playerParams[i] = mergedValue; > } > // set default skin if override not present > if (playerParams.skinURL == '') { > playerParams.skinURL = > Site.MediaPlayer.Skins[playerParams.mediaType.toLowerCase()]; > } > // find media features, if included. This could probably be > refined but it works for now. > if (playerParams.mediaType == 'video' && > playerParams.playlistURL != '') { var mediaFeature = 'gallery'; } > else if (playerParams.mediaType == 'image' && > playerParams.audio == 'true') { var mediaFeature = 'audio'; } > // get dimensions for media type, or mediaType + mediaFeature > var dimensions = > Site.MediaPlayer.Dimensions[playerParams.mediaType]; > dimensions = (mediaFeature && > dimensions[mediaFeature]) ? dimensions[mediaFeature] : dimensions; > // general swf params for the player > var swfParams = { > allowFullScreen:'true', > menu:'false', > wmode:'transparent' > }; > var swfAttrs = {}; > // show some handy logging info for debug purposes > if (typeof(console.log) == 'function') { > /* console.log('PLAYER URL', > Site.MediaPlayer.PlayerSwfURL); > console.log('TARGET ELEMENT', targetElement || > 'MODAL'); > console.log('PLAYERPARAMS', playerParams);*/ > } > // NOTE: the following chunk of code is a workaround for a > swfObject design issue. > // swfObject expects an id string to represent the target > element ... which is not > // ideal to say the least for general-purpose embedding in raw > elements. to make > // up for this problem we look at the target element, and > check it for an ID. If > // it has one, we use it. If not, we assign it a random ID and > then use that. > if (targetElement && typeof(targetElement) != > 'string') { > var targetID = $(targetElement).attr('id'); > if (!targetID) { > var targetID = > 'mediaplayerrandomidgen-'+(Math.round(Math.random()*100000)); > while > (document.getElementById(targetID)) { > var targetID = > 'mediaplayerrandomidgen-'+(Math.round(Math.random()*100000)); > } > $(targetElement).attr('id', > targetID); > playerParams.overlay = ''; > } > } else if (!targetElement) { > modal.enter('<div > id="ModalMediaPlayerParent"></div>') > var targetID = 'ModalMediaPlayerParent'; > playerParams.overlay = 'true'; > } > // go ahead and embed the swf with swfobject. > if (Site.MediaPlayer.flashSupported) { > swfobject.embedSWF( > Site.MediaPlayer.PlayerSwfURL, > targetID, > dimensions.width, > dimensions.height, > > Site.MediaPlayer.FlashVersionRequired, > 'expressInstall.swf', > playerParams, > swfParams, > swfAttrs > ); > } else if (!Site.MediaPlayer.flashSupported && > targetID == 'ModalMediaPlayerParent' ) { > modal.enter('<div > id="ModalMediaPlayerParent"><h1>To view this content, you need the > flash player</h1><h1><a href="http://adobe.com/getflash/" > target="_blank">download the flash player here.</a></h1></div>'); > } > }, > // media-specific load functions > loadVideo : function(paramObj, targetElement) { > paramObj.mediaType = 'video'; > Site.MediaPlayer.Load(paramObj, targetElement); > }, > loadAudio : function(paramObj, targetElement) { > paramObj.mediaType = 'audio'; > Site.MediaPlayer.Load(paramObj, targetElement); > }, > loadImage : function(paramObj, targetElement) { > paramObj.mediaType = 'image'; > Site.MediaPlayer.Load(paramObj, targetElement); > }, > // initialization of link-scheme items > Init : function() { > // detect support > Site.MediaPlayer.flashSupported = > (swfobject.getFlashPlayerVersion().major >= > parseInt(Site.MediaPlayer.FlashVersionRequired.charAt(0))); > // audioLinkage > $('a[href^=http://get.adobe.com/flashplayer/ > #mediaPlayer/loadAudio:]').each(function(){ > var playerWrap = $(this); > playerWrap.click(function(){if > (Site.MediaPlayer.flashSupported) { return false; }}) > var audioPath = > playerWrap.attr('href').split('loadAudio:')[1].split('&')[0]; > Site.MediaPlayer.loadAudio({ > mediaURL : audioPath > }, playerWrap.get(0)); > }); > //imageLinkage > $('a[href^=http://get.adobe.com/flashplayer/ > #mediaPlayer/loadImage:]').each(function(){ > var playerWrap = $(this); > var playlistURL = > playerWrap.attr('href').split('loadImage:')[1]; > var audioSTR = ((/\&audio > \:true/).test(playerWrap.attr('href'))) ? 'true': ''; > var inline = ((/\&inline > \:true/).test(playerWrap.attr('href'))) ? playerWrap.get(0): null; > var makeMovie = function() { > Site.MediaPlayer.loadImage({ > playlistURL : > playlistURL, > audio : > audioSTR > }, inline); > } > if (inline) { > makeMovie(); > playerWrap.click(function(){ > if > (Site.MediaPlayer.flashSupported) { return false; } > }); > } else{ > playerWrap.click(function(){ > makeMovie(); > return false; > }); > } > }); > //videoLinkage > $('a[href^=http://get.adobe.com/flashplayer/ > #mediaPlayer/loadVideo:]').each(function(){ > var playerWrap = $(this); > var playlistURL = > playerWrap.attr('href').split('&playlist:')[1].split('&')[0]; > var mediaURL = > playerWrap.attr('href').split('loadVideo:')[1].split('&')[0]; > var videoimg = > playerWrap.attr('href').split('&loadImage:')[1].split('&')[0]; > var inline = ((/\&inline > \:true/).test(playerWrap.attr('href'))) ? playerWrap.get(0): null; > var makeMovie = function() { > Site.MediaPlayer.loadVideo({ > playlistURL : playlistURL, > mediaURL : mediaURL, > videoimg : videoimg > }, inline); > } > if (inline) { > makeMovie(); > playerWrap.click(function(){ > if > (Site.MediaPlayer.flashSupported) { return false; } > }); > } else{ > playerWrap.click(function(){ > makeMovie(); > return false; > }); > } > }); > }, > // Default Skins > Skins : { > video : '/includes/audio-video/mediaPlayer/swf/ > videoskin.swf', > audio : '/includes/audio-video/mediaPlayer/swf/ > audioskin.swf', > image : '/includes/audio-video/mediaPlayer/swf/ > imageskin.swf' > }, > // stores dimensions for various states of the mediaPlayer > Dimensions : { > video : { > width:530, > height:336, > gallery: { > width:530, > height:423 > } > }, > image : { > width:530, > height:340, > audio: { > width:530, > height:360 > } > }, > audio : { > width:180, > height:21 > } > } > }; > > Please advice. > > Thanks, > Amit > > On Feb 9, 4:15 pm, Aran Rhee <[email protected]> wrote: > > Autoplaying a video has nothing to do with SWFObject directly. This is > > controlled by whatever flash file your are embedding on your page to load > > and play the video. > > > > Aran > > > > > > > > On Wed, Feb 10, 2010 at 8:55 AM, Amit <[email protected]> wrote: > > > Is it possible to auto-play .flv or .f4v file using SWFObject v2.2? > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "SWFObject" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<swfobject%[email protected]> > <swfobject%2bunsubscr...@googlegroups .com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/swfobject?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "SWFObject" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<swfobject%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/swfobject?hl=en. > > -- You received this message because you are subscribed to the Google Groups "SWFObject" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/swfobject?hl=en.
