Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,380
    Thanks
    264
    Thanked 32 Times in 31 Posts

    adding preview to the new SWFobject

    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

    Code:
    <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.

    Code:
     
    s1.write('preview');

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

    Code:
    <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

    Code:
    <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.
    Last edited by durangod; 09-18-2011 at 02:09 PM.

  • #2
    Regular Coder
    Join Date
    Mar 2011
    Posts
    148
    Thanks
    0
    Thanked 20 Times in 20 Posts
    Hi,
    Try add the js code for embed into a function, then execute that function after the page was loaded, with window.onload .

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,380
    Thanks
    264
    Thanked 32 Times in 31 Posts
    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.
    Last edited by durangod; 09-17-2011 at 02:38 PM.

  • #4
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,380
    Thanks
    264
    Thanked 32 Times in 31 Posts
    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

    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.

  • #5
    New to the CF scene
    Join Date
    Aug 2011
    Location
    India
    Posts
    7
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Thanks

    Thanks for this thread. I am also searching for this.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •