Orionsbelter Posted May 8, 2008 Share Posted May 8, 2008 hi does anyone know how to play a sound in the background of a page. so say like i click on someone thing play a sound. please help. thanks Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/ Share on other sites More sharing options...
The Little Guy Posted May 8, 2008 Share Posted May 8, 2008 there are a few ways to do it: 1. invisible flash (1x1 doc) 2. <embed src="yourmusicfile.mid" autostart="true" loop="true" width="2" height="0"> </embed> 3. <bgsound src="yourmusicfile.mid" loop="infinite"> Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-535984 Share on other sites More sharing options...
Orionsbelter Posted May 8, 2008 Author Share Posted May 8, 2008 and can i echo this? Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-535988 Share on other sites More sharing options...
The Little Guy Posted May 8, 2008 Share Posted May 8, 2008 yes Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-535991 Share on other sites More sharing options...
Orionsbelter Posted May 8, 2008 Author Share Posted May 8, 2008 cheers mate Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-535994 Share on other sites More sharing options...
947740 Posted May 8, 2008 Share Posted May 8, 2008 The valid way is to use CSS. I believe the <embed> tags result in an error when validated. Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536005 Share on other sites More sharing options...
The Little Guy Posted May 8, 2008 Share Posted May 8, 2008 CSS can not play sound, it can only be done using "HTML" or "HTML and flash/java" or some other plug-in. Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536340 Share on other sites More sharing options...
947740 Posted May 9, 2008 Share Posted May 9, 2008 Got it mixed up with the background-image. Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536777 Share on other sites More sharing options...
nafetski Posted May 9, 2008 Share Posted May 9, 2008 Please for the love of all that is holy don't make websites that auto play music. Especially midi. Or if it DOES auto play music, give me a big huge button to smash that makes it stop fast. Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536818 Share on other sites More sharing options...
947740 Posted May 9, 2008 Share Posted May 9, 2008 All you have to do is press Esc. Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536832 Share on other sites More sharing options...
nafetski Posted May 9, 2008 Share Posted May 9, 2008 Not for flash, at least not on a mac. Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536845 Share on other sites More sharing options...
947740 Posted May 9, 2008 Share Posted May 9, 2008 True, unless you enable the key. I think it is rather pointless to use flash just for a background sound, however. Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536913 Share on other sites More sharing options...
The Little Guy Posted May 9, 2008 Share Posted May 9, 2008 You also must click on the flash to enable key presses, mouse clicks, etc. Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536925 Share on other sites More sharing options...
947740 Posted May 9, 2008 Share Posted May 9, 2008 That is very true. Another reason I do not like flash. Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536930 Share on other sites More sharing options...
Orionsbelter Posted May 9, 2008 Author Share Posted May 9, 2008 how easy is flash to learn and use? Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-536946 Share on other sites More sharing options...
The Little Guy Posted May 9, 2008 Share Posted May 9, 2008 You flash actionscript could look like this: // create a new Sound object var my_sound:Sound = new Sound(); // if the sound loads, play it; if not, trace failure loading my_sound.onLoad = function(success:Boolean) { if (success) { my_sound.start(); status_txt.text = "Sound loaded"; } else { status_txt.text = "Sound failed"; } }; // load the sound my_sound.loadSound("http://mysite.com/audio/song.mp3", true); Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-537063 Share on other sites More sharing options...
Orionsbelter Posted May 9, 2008 Author Share Posted May 9, 2008 i thanks but i used the other one and it worked:D Link to comment https://forums.phpfreaks.com/topic/104722-solved-php-playing-sound-in-background-help-please/#findComment-537076 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.