Not signed in (Sign In)

Vanilla 1.0.3 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  
    Hi

    I am having trouble trying to put 2, or more, flash videos on a single web page using the SWFObject. I have read the previous posts on this Forum, including the 'sticky' and FAQ which tells you how to amend the code, and I have 'googled' my problem for days, but I am still having problems.

    I can get one video to load and play, no problem.
    When I try 2 (or more) they don't work, and sometimes don't even show completely.

    The code I am using is


    <script type="text/javascript"src="swfobject.js"></script>

    [Unfortunately, I have to put this as near the top of my web page as possible as my web host does not give me access to the 'Head']




    <center>
    <H1><font face=Verdana>ThruTheNight</font></H1><br>

    <div id=flashcontent01>
    Upgrade your Flash Player to view this video! See top of page.</div>

    <script type="text/javascript">

    var sothruthenight = new SWFObject("Charcoal1.swf?path=videos/thruthenight.FLV&buffersize=2&startauto=false&redirect=", "player", "500", "410", "8", "#ffffff");

    sothruthenight.write("flashcontent01");

    </script>
    </center>

    <center>
    <H1><font face=Verdana>Iwishitcouldbexmas</font></H1><br>

    <div id=flashcontent02>
    Upgrade your Flash Player to view this video! See top of page.</div>

    <script type="text/javascript">

    var soIwishitcouldbexmas = new SWFObject("Charcoal2.swf?path=videos/Iwishitcouldbexmas.FLV&buffersize=2&startauto=false&redirect=", "player", "500", "410", "8", "#ffffff");

    soIwishitcouldbexmas.write("flashcontent02");

    </script>
    </center>



    The link to the URL where I am testing this out is
    http://www.swingin60smusic.com/6.html

    The videos, in their current state are quite a way down the page (well I don't want anyone to see them by mistake!!!!)

    I am new to this forum and quite new to owning a website too: I hope I am asking in the right place and that someone here can help me.

    Thanks for your time.
    • CommentAuthorphilip
    • CommentTimeApr 8th 2008
     
    you're using the same ID for both SWFs ("player"). you should also put your parameters into an addVariable statement.


    <div id=flashcontent01>Upgrade your Flash Player to view this video! See top of page.</div>

    <script type="text/javascript">
    var sothruthenight = new SWFObject("Charcoal1.swf", "player01", "500", "410", "8", "#ffffff");
    sothruthenight.addVariable("path", "videos/thruthenight.FLV");
    sothruthenight.addVariable("buffersize", "2");
    sothruthenight.addVariable("startauto", "false");
    sothruthenight.addVariable("redirect", "");
    sothruthenight.write("flashcontent01");
    </script>

    <div id=flashcontent02>Upgrade your Flash Player to view this video! See top of page.</div>

    <script type="text/javascript">
    var soIwishitcouldbexmas = new SWFObject("Charcoal2.swf", "player02", "500", "410", "8", "#ffffff");
    soIwishitcouldbexmas.addVariable("path", "videos/Iwishitcouldbexmas.FLV");
    soIwishitcouldbexmas.addVariable("buffersize", "2");
    soIwishitcouldbexmas.addVariable("startauto", "false");
    soIwishitcouldbexmas.addVariable("redirect", "");
    soIwishitcouldbexmas.write("flashcontent02");
    </script>


    - philip
    • CommentAuthorAran
    • CommentTimeApr 8th 2008 edited
     
    EDIT - @Philip - you beat me to it :)

    Ok. A couple of things. SWFObject 1.x is now considered deprecated. There is a link at the top of the forums to the SWFObject 2.0 code and Google group.

    1) If you are still going to work with SWFObject 1.x, then you should upgrade to the latest 1.5 (you are using 1.4.4 which is quite old)
    2) If you are passing variables, then you should do so via addVariable, rather than the querystring. This way you can use the same player swf and just change the path.

    e.g.

    var sothruthenight = new SWFObject("Charcoal1.swf", "player", "500", "410", "8", "#ffffff");
    sothruthenight.addVariable("path", "videos/thruthenight.FLV");
    sothruthenight.addVariable("buffersize", "2");
    sothruthenight.addVariable("startauto", "false");
    sothruthenight.addVariable("redirect", "");


    3) you are using the same ID for both videos of "player", you should change this to "player1", "player2" etc.


    Also, you might be getting IE caching issues on your FLV files when you reload the page, and that is why they don't appear sometimes. You can stop the caching of the files by adding a unique id at the end of the files like:

    sothruthenight.addVariable("path", "videos/thruthenight.FLV?r=" + new Date().getTime());


    Cheers,
    Aran
    • CommentAuthorphilip
    • CommentTimeApr 8th 2008
     
    just call me quickdraw mcgraw! :) hehehe...

    (yes, i wish it was friday.)
  2.  
    Thank you Aran and Thank you Philip. (I am sorry I've taken so long to come back to you but I got caught up working extra shifts to cover for sick absences on our Ward.)

    It all sounds so simple when you explain it!!!! Thanks for your advice, and for putting it in a way I could understand. I really do appreciate the time you took to help out a 'newbie'.

    Thanks again chaps.

    Pauline