Problems integrating sound on web page...

Dark Prodigy

Jawbreaker
Joined
Mar 10, 2006
Messages
2,803
Doing a small "practice" web site and I'm having a small problem with the sound.

The music is embedded in a small Flash file I wrote with AS 3.0 that is designed to play when the web site is opened. The problem is that while the music starts up normally, I'm getting some sort of "2nd loop".

The music starts but seconds later an echo/reverb begins to happen. If I refresh the page it goes away and plays normally. I do not like this.


here's the AS I wrote for it:


Code:
var thissound:URLRequest = new URLRequest("desire.mp3");  
var s:Sound = new Sound();   
s.load(thissound);  
var song:SoundChannel = s.play();


function setMute(vol){
	var sTransform:SoundTransform = new SoundTransform(1,0);
	sTransform.volume = vol;
	SoundMixer.soundTransform = sTransform;
}

var Mute:Boolean = false;


button_mute.addEventListener(MouseEvent.CLICK, togglemute);
function togglemute(event:Event){
	if(Mute){
		Mute = false;
		setMute(1);
	}else{
		Mute = true;
		setMute(0);
	}
}

This is the insertion and the mute button I wrote for it. There's only one instance of the song placed inside of the site folder.

Anything look fishy? I can link the web page if you want to hear it for yourself.
 
Music on webpages is a crime punishable by death. Don't do it.

To those who may complain I'm not answer his question: it is wrong to help someone commit a crime against humanity.
 
*sigh* If its what a person asks for then why not give it to them. Plus, music on a web page is not a crime... music on a web page without a very visible way to turn it off is a crime...


Now.. can anyone help?
 
So it works normally offline until you actually use it on the website? Have you checked your html and haven't accidentally called the flash object twice?
 
So it works normally offline until you actually use it on the website? Have you checked your html and haven't accidentally called the flash object twice?

Testing it locally or testing it online yields the same results. Double checked my HTML and it seems fine. I embedded the flash file within my container properly. Would it have something to do with being within my local network instead of outside of it....?
 
I just tried your code and running it on my browser, it works fine. I'm sending you the freehostia link.
 
I just tried your code and running it on my browser, it works fine. I'm sending you the freehostia link.


Received the link. Thanks for verifying my code (never heard of freehostia ). However, this does raise a question. I am hosting the website on my own with Apache installed on an older PIII system I use as a back up PC.

Being the newbie that I am with this, could there be some sort of network glitch going on here with me connecting to the website from my own LAN.
 
Freehostia has a 500kb per file limit so i can't recommend it for media sites =P

I doubt it has to do with the network. It's delivering the website just fine if you can actually hear the music. I recommend doing what I did and just make a simple site to test the code yourself.
 
I'm wondering if it's your ancient server that's struggling. Maybe it doesn't have enough RAM or CPU horsepower to cache the file properly before serving it? Just a wild guess on my part.
 
Looks like a good time to introduce tracing, or at least message outputs of details (such as Url resolved to the mp3 file by the client-side flash object). Also, how big is the mp3 file?
 
Looks like a good time to introduce tracing, or at least message outputs of details (such as Url resolved to the mp3 file by the client-side flash object). Also, how big is the mp3 file?


Yeah, I inserted a few simple tracing lines in the code to test it and everything returned proper values. The .mp3 is 2.17Mb.
 
Back
Top