JavaScript - Automatically Stop Audio Player After 10 Seconds
Hello to all,
Can anyone please assist in the following?: I have an embed code that needs to play only the first 10 seconds of an mp3 or audio file <EMBED SRC="clip.mp3" WIDTH=144 HEIGHT=60 STARTTIME="00:00" ENDTIME="00:10" > Unfortunately all the MP3 is getting streamed and the the STARTTIME and ENDTIME work on Netscape only Is there any way to stop an audio file from streaming after a number of seconds? If there is a way to crop the mp3 during the upload process, I would appreciate your help in this direction Thanks Simon Similar TutorialsI have a welcome message on my site and would like to automatically hide it after several seconds. I can't find anything usable after searching over the internet. Can anyone help? Thanks in advance. I put together a custom audio player using code from a few players. http://66.147.244.101/~fastlif2/wp-c...mp3player.html The player works in CHROME perfectly. The AUDIO tag supports mp3's in Chrome. However, there are compatibility issues in other browers. The audio tag works in FireFox, but only with ogg files (which I don't have). And IE is pretty useless. So, I need to have the player play in Chrome normally (as it is now). If the browser does not support mp3s or the audio tag, I want to default to my Flash player. And, if flash isn't supported, then I want to have a download link. I thought that if the browser didn't support the audio tag, it would default to the embed code that I have listed in there ... but it isn't working. Odd. Any idea what is wrong? Since I am not a strong javascript programmer, I need some way to check this. Also, there is so much javascript, the I am very hesitant to play with the code anymore (as I may mess it up). Please help I am working on a website that features a custom javascript enabled audio player with an animated playhead to follow along with the provided spectrogram. An example of this is included below. http://cetus.ucsd.edu/voicesinthesea.../humpback.html I am having difficulty figuring out why the audio/spectrogram player does not work on an iPad. This component was built by a developer who I am not longer in contact with, thus I am in urgent need of some advice/wisdom. Thank you! Hello and thank you for you help, we have a problem in our currently built website, in chrome+firefox the website works great but in IE 7+8+9 the javascript stops working after few seconds or after several commands a user do in the website. the url is : http://www.triver.co.il if any one know what can be the issue it will be great thank you ! Hello, I found the javascript for triggering audio on mouseOver (on the page link below) very helpful. Question is - how to stop the audio on mouseout? http://www.javascriptkit.com/script/....shtml#current I am creating a very content rich news/media website that requires an audio player. The audio player should be seen by the user as soon as they enter the website and the playlist should play throughout their time spent at the website and should not be restarted or stopped when navigating the website. We originally were using a frameset for the audio player, but the fact that none of the pages through out the site could be reached through a link in the URL bar proved to be too much of an issue. So the new idea was to open the audio player in a javascript pop-up window. But because of the nature of the website, we found that it was very common for users to go "back" in their browser to the homepage after they had navigated away, which would cause the pop-up code to be activated again and would make the pop-up reload, interrupting the audio. So then we moved the pop-up code to the splash page so that when you enter the main page, its already open, and it can't be interrupted. But THEN we found that the pop-up window was of course opened behind the main website's window, which made it hidden and useless. So we currently have no solutions! All we need is for this pop-up window to take focus and be the very top window, and once its opened to never be reloaded/refreshed again. Does anyone have a solution?! Any help is appreciated! how long are these numbers? Code: setImageInterval("ad1", 1000, 3); I know 3 is the max, but the 1000 = how many seconds? Thanks -Tim I need to develop this feature for a charity site displays a number that counts up 1 every 15 seconds. This is to show how many times a kid is abused in this country. I've been researching this and haven't been able to find anything helpful yet. I figured this piece of code was a good start: function doSomething() { setTimeout('doSomething()',15000); } Hey guys..... I'm wondering how you go about getting a script to run every 30 seconds for example? Thanks a lot! Hi I am creating an animation based on Sam Dunn's tutorial 'Animate Curtains Opening with jQuery' ( http://buildinternet.com/2009/07/ani...g-with-jquery/ ). What i need to do is create a 2 second delay in the curtains opening in order to give enough time for an iframe, thats behind the curtains, to load it's content. Here is Sam's script : ----------------------------------------------------------------- <!-- Animate a Curtain Opening with jQuery index.html By Sam Dunn 2009 Build Internet! www.buildinternet.com --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Animate a Curtain Opening with jQuery | Build Internet</title> <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script> <script src="jquery.easing.1.3.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $curtainopen = false; $(".rope").click(function(){ $(this).blur(); if ($curtainopen == false){ $(this).stop().animate({top: '0px' }, {queue:false, duration:350, easing:'easeOutBounce'}); $(".leftcurtain").stop().animate({width:'60px'}, 2000 ); $(".rightcurtain").stop().animate({width:'60px'},2000 ); $curtainopen = true; }else{ $(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'}); $(".leftcurtain").stop().animate({width:'50%'}, 2000 ); $(".rightcurtain").stop().animate({width:'51%'}, 2000 ); $curtainopen = false; } return false; }); }); </script> <style type="text/css"> *{ margin:0; padding:0; } body { text-align: center; background: #4f3722 url('images/darkcurtain.jpg') repeat-x; } img{ border: none; } .leftcurtain{ width: 50%; height: 495px; top: 0px; left: 0px; position: absolute; z-index: 2; } .rightcurtain{ width: 51%; height: 495px; right: 0px; top: 0px; position: absolute; z-index: 3; } .rightcurtain img, .leftcurtain img{ width: 100%; height: 100%; } .logo{ margin: 0px auto; margin-top: 150px; } .rope{ position: absolute; top: -40px; left: 70%; z-index: 4; } </style> </head> <body> <div class="leftcurtain"><img src="images/frontcurtain.jpg"/></div> <div class="rightcurtain"><img src="images/frontcurtain.jpg"/></div> <img class="logo" src="images/buildinter.png"/> <a class="rope" href="#"> <img src="images/rope.png"/> </a> </body> </html> ----------------------------------------------------------------- Any help will be greatly appreciated. Thanks. Jet. topic has been answered
Trying to setup a cookie read/write in JS. Page 1 sets the JS cookie using Flash. Page 2 reads the JS cookie from Flash. I have this working. The problem is that I need the cookie to expire in a matter of seconds. This is my code for creating the cookie and expiration: Code: function setCookie(name, value) { var today=new Date; today.setTime(today.getTime()+3000); document.cookie = name+"="+value; +"; expires="+today.toGMTString(); //alert(name + " "+value); alert("Value is: "+value+"\n Expires in: "+today); } The problem isn't that cookie isn't there. I just can't seem to get it to expire. Please help. This is the script to hide the div (adsdiv) Its working on all browser except IE Code: <script type="text/javascript"> function closeMyAd() { document.getElementById("adsdiv").style.display = "none" ; } var milisec=0 var seconds=30 function display(){ if (milisec<=0){ milisec=9 seconds-=1 } if (seconds<=-1){ milisec=0 seconds+=1 } else milisec-=1 if( seconds > 0 ) { document.getElementById( "closingtimer" ).innerHTML = seconds ; setTimeout("display()",100) ; }else{ closeMyAd() ; } } if( document.getElementById( "closingtimer" ) ) display() ; </script> Hi people, I'm building an online psychological experiment in which I need to display an image for 5 seconds on the screen. Does anyone has a simple script for that? I found some script that does image rotation but its not exactly what I am looking for. First, the rotation of the images doesn't stop and second I don't need something so elaborate. This is the script that I found. Code: <SCRIPT LANGUAGE="JavaScript"> <!-- var dimages=new Array(); var numImages=2; for (i=0; i<numImages; i++) { dimages[i]=new Image(); dimages[i].src="images/image"+(i+1)+".jpg"; } var curImage=-1; function swapPicture() { if (document.images) { var nextImage=curImage+1; if (nextImage>=numImages) nextImage=0; if (dimages[nextImage] && dimages[nextImage].complete) { var rel="nofollow" target=0; if (document.images.myImage) rel="nofollow" target=document.images.myImage; if (document.all && document.getElementById("myImage")) rel="nofollow" target=document.getElementById("myImage"); // make sure target is valid. It might not be valid // if the page has not finished loading if (target) { target.src=dimages[nextImage].src; curImage=nextImage; } setTimeout("swapPicture()", 5000); } else { setTimeout("swapPicture()", 500); } } } setTimeout("swapPicture()", 5000); //--> </SCRIPT> Thanks Hello, I found this code, written by Philip M on another thread of this forum: Code: <div id = "adsdiv">This ad will close in <span id = "closingtimer">31</span> seconds </div> <script type="text/javascript"> function closeMyAd() { document.getElementById("adsdiv").style.display = "none" ; } var seconds = 31; function display() { seconds --; if (seconds < 1) { closeMyAd(); } else { document.getElementById( "closingtimer" ).innerHTML = seconds ; setTimeout("display()", 1000); } } display(); </script> I need to reverse the script to show a div after 30 seconds, not to hide it. Can you please help me? Thank you. I want a code that changes text (of maybe a div) after 10 seconds. So like i could have some text and a link on my page then after 10 seconds it will change to something else and i can make it change to as many things as i want. Then when it goes threw them all it starts over. THANKS Can someone help me to modify this JS to close if user is no longer hovering over child link after 5 seconds? Code: $(document).ready(function () { $('#menuHolder ul li a').mouseover(function (event) { if (this == event.target) { $(this).parent().toggleClass('clicked'); if ($(this).parent().attr('class').indexOf('clicked') != -1) { $(this).siblings('ul').animate({"top": "35px"}, {queue:false,duration:(500)}, "swing"); } else { $(this).siblings('ul').animate({"top": "0px"}, {queue:false,duration:(500)}, "swing"); } $(this).parent().siblings().removeClass('clicked').find('ul').animate({"top": "0px"}, {queue:false,duration:(500)}, "swing"); } }) $('#menuHolder ul li:not(:has(ul)) a').mouseout(function (event) { if (this == event.target) { $(this).parent().toggleClass('clicked'); $(this).parent().siblings().removeClass('clicked').find('ul').animate({"top": "0px"}, {queue:false,duration:(500)}, "swing"); } }); }); </script> I am new to javascript and am trying to make a script that would open a link every xx randomly seconds. So far I have come up with this after searching: Code: <script> function reloadMe() { window.location.reload(); } function getInterval(){ var lowerBound = 30; var upperBound = 60; var randNum = Math.floor((upperBound-lowerBound+1)*Math.random()+lowerBound) * 1000; return randNum; } var interval = getInterval(); var srcInterval = setInterval("reloadMe()",interval); </script> This works on refreashing a page every xx seconds between 30 and 60 seconds. But it does not open a link. Is it possible to make a script that opens a link every xx seconds at random. It would be even greater if it can exclude certian times of the day, or can that be done with a cron job? |