Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    16
    Member #
    27272
    So I have a javascript-controlled HTML5 audio player, and so when the song has stopped playing I want the URL to redirect.
    Once the song has stopped playing, var audio.ended turns from false to true. How would I tell the browser to redirect once the variable turns true?

    My current code is:

    Code:
    <script type="text/javascript">
    setInterval(checkEnded(), 500 );
    function checkEnded()
    {
    if(audio.ended==true){
        window.location = "frame.php?id=20&1=89&2=43&3=46&4=56&5=66&6=65&7=117&8=80&9=70&10=52&11=90&12=114&13=193&14=183&15=103&16=101&17=189&18=111&19=64&20=";
    }
    </script>
    Why does this not work?
    Thanks!

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    You want window.location.href.

    window.location was supposed to be a shorthand property for window.location.href from what I can gather, but it never did work right. So go with this. That should work fo' sho'.

    Not really sure why you need an interval function, either. You can use the window.location.href line immediately after you turn audio.ended to true (I'm assuming it's done in the same Javascript). Unless there's something else that goes on that requires the delay, that is.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    16
    Member #
    27272
    Thanks man, but the thing is that we don't know when the song will end. Thats why we have to check all the time if the song has ended. I will dig deeper into this!

    Appreciate the help!

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Ahhh okay. I thought it was the same song being used.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    Junior Member
    Join Date
    Mar 2011
    Posts
    16
    Member #
    27272
    So I just found out that there is an event caller which is called onended="", which calls a JavaScript function once the audio has stopped playing. This works more than great in Chrome and Safari. Thank you Google!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:18 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com