...

View Full Version : Resolved adding preview to the new SWFobject



durangod
09-17-2011, 04:56 AM
hi, i upgraded my SWF object about 3 months ago and have been trying to find a way to add the preview back in there, but dont know how with the new process since what i had originally was ancient.

the old code was like this




<script type='text/javascript'>
var s1 = new SWFObject('player.swf','player','400','300','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('flashvars','file=$ROOT/movies/$sql_array->vid_id.flv');
s1.write('preview');
</script>




the issue is that the new way is totally differnent - no longer do you have the javascript and embed on the same page, the javascript goes in the header and the view code goes in the file now.

so how do i add this to the new way of coding.



s1.write('preview');



here is the new way of doing it and this is in the php header



<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("player", "9.0.0");
</script>


and then this is in the the files you want to display the video on




<object classid="clsid: my class id went here" width="175" height="175" id="player" name="player" align="middle">
<param name="movie" value="player.swf" />
<param name="play" value="false" />
<param name="quality" value="high" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=<?=$ROOT?>/movies/<?=$sql_array->vid_id?>.flv" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="player.swf" width="175" height="175" align="middle">
<param name="play" value="false" />
<param name="quality" value="high" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=<?=$ROOT?>/movies/<?=$sql_array->vid_id?>.flv" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>








i think i can add it is a param flashvar but im not sure how on this code

Just fyi i upload my vids using FFMPEG so in the dir there is a flv and associated jpg for the view for each vid.

in other words there is a 1.flv and a 1.jpg i just need to figure out how to display the jpg for each vid in the code above.

MarPlo
09-17-2011, 08:05 AM
Hi,
Try add the js code for embed into a function, then execute that function after the page was loaded, with window.onload .

durangod
09-17-2011, 02:34 PM
didnt work but thanks i think this 2.+ version of swfobject differs from the 1.+ older versions because it does not allow inner content div until after its loaded. I think i have to do a call to css using the swfobject param css call but you know i really dont know, it does not seem it should be that hard. param bgcolor does not work, nor does param preview with the file link.

i also tried adding the write preview in the header js like the old one but still did not work. Some how someplace someone had to of tackled this issue of having something other than a black face video and putting an image inside the box with version 2.+ swfobject, but i have not found where anyone has done this yet. ill keep looking, any help is appreciated.

durangod
09-17-2011, 07:10 PM
hot dang!!! 5 hours reading and searching the net and i finally figured it out. on a whim i changed this line and low and behold i now have a background image preview for the movies.

Everthing i read on swfobject site and others talked about creating a parent div and a bunch of other coding and i was like
there has to be a better way. and there is!!

sooooooooo simple but yet so ellusive lmao..

just change this line in both places and add the &image code




<param name="flashvars" value="file=<?=$ROOT?>/movies/<?=$sql_array->vid_id?>.flv&image=<?=$ROOT?>/movies/<?=$sql_array->vid_id?>.jpg" />



wooooo hooooo im a happy camper lol i hope this saves someone else the 5 hours time i spend on this, and your welcome.

sansramm
09-17-2011, 07:13 PM
Thanks for this thread. I am also searching for this.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum