1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Looking to display random Video but don't know how

Discussion in 'PHP & Perl' started by The Joker, Nov 30, 2009.

  1. The Joker

    The Joker BANNED BANNED

    Joined:
    Apr 8, 2008
    Messages:
    308
    Likes Received:
    152
    hi guys n girls, I have some .flv videos I want to randomly display on my blog when the page is refreshed, when the video is finished I don't want it to go to the next video.

    I've had a look on google and can't find anything that helps.

    the code I am using to display the current video is

    Code:
    		<script type="text/javascript">
    			
    			var so = new SWFObject("flvPlayer.swf?imagePath=movie.png&videoPath=movie.flv&autoStart=false&autoHide=false&autoHideTime=5&hideLogo=true&volAudio=60&newWidth=720&newHeight=540&disableMiddleButton=false&playSounds=true&soundBarColor=#0066cc&barColor=#0066cc&barShadowColor=0x91BBFB&subbarColor=0xffffff", "sotester", "640", "505", "9", "#efefef");
    			so.addParam("allowFullScreen", "true");
    			so.write("flashcontent");
    			
    		</script>

    also I want to use the code above as the player I am using looks pretty good and hopefully i can keep the look of it while displaying the random vids

    any one able to help?

    thanks
     
    Last edited: Nov 30, 2009
  2. ukescuba

    ukescuba Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 24, 2008
    Messages:
    994
    Likes Received:
    634
    Occupation:
    Mobile Marketer & QR Code Junkie
    Location:
    San Antonio, TX
    Home Page:
    how many videos do you have?
     
  3. ukescuba

    ukescuba Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 24, 2008
    Messages:
    994
    Likes Received:
    634
    Occupation:
    Mobile Marketer & QR Code Junkie
    Location:
    San Antonio, TX
    Home Page:
    if you had 3 videos use this...

    it will give you a random number between 1 and 3, if you had 5 videos you would use (1,5)

    call your videos movie1.flv, movie2.flv, etc do the same for your screen thumbnails too...

    the php code below simply appends the random number generated to the filename movie...

    hope that makes sense...

    Code:
    <?php $num = rand(1, 3); ?>
    <script type="text/javascript">		
    var so = new SWFObject("flvPlayer.swf?imagePath=movie<?php echo $num; ?>.png
    &videoPath=movie<?php echo $num; ?>.flv
    &autoStart=false
    &autoHide=false
    &autoHideTime=5
    &hideLogo=true
    &volAudio=60
    &newWidth=720
    &newHeight=540
    &disableMiddleButton=false
    &playSounds=true
    &soundBarColor=#0066cc
    &barColor=#0066cc
    &barShadowColor=0x91BBFB
    &subbarColor=0xffffff","sotester", "640", "505", "9", "#efefef");
    so.addParam("allowFullScreen", "true");
    so.write("flashcontent");
    </script>
    
    havent tested this just going off the top of my head! :)

    hth ukescuba
     
    • Thanks Thanks x 2
  4. The Joker

    The Joker BANNED BANNED

    Joined:
    Apr 8, 2008
    Messages:
    308
    Likes Received:
    152
    got ya. I see how it works, I'll give it a try now

    edit: hmmm still wouldn't work.. the number of the video seems to be random and working but the video doesn't play lol I'll keep looking, thanks for the help though
     
    Last edited: Dec 1, 2009
  5. ukescuba

    ukescuba Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 24, 2008
    Messages:
    994
    Likes Received:
    634
    Occupation:
    Mobile Marketer & QR Code Junkie
    Location:
    San Antonio, TX
    Home Page:
    let me know how you get on - i used something similar today and it worked fine
     
  6. The Joker

    The Joker BANNED BANNED

    Joined:
    Apr 8, 2008
    Messages:
    308
    Likes Received:
    152
    Aweesomee. It works sweeet, don't know what was wrong before. thank you