File.prototype.OpenAudioFile = function(dPath)
{
	var rem = document.createElement("div")
	rem.name = "divv";
	rem.id = "divId";
	
	rem.innerHTML = '<embed src="' + dPath + '" autostart="false" name="' + dPath + '"></embed>';

	document.body.appendChild(rem);
}

I'm using the way above to solve my sound problem but when i attach div object to document sound plays automaticly.is there any solution for it?

by the way, im not working on internet browsers, it's a part of a framework for tv. it supports js 1.2.

Recommended Answers

All 3 Replies

That looks like it's due to a faulty flash object, not javascript.

i write to create <embed> object using document.write but as i read document.write isnt supported by our middleware yet and im trying to find different ways to load and play sounds. can you tell me how to load and play sounds dynamicly?

i write to create <embed> object using document.write but as i read document.write isnt supported by our middleware yet and im trying to find different ways to load and play sounds. can you tell me how to load and play sounds dynamicly?

Put the <embed> element in your code - no need to create it through javascript - and leave its source string empty!
Than you can set its source by user action that will trigger a simple function that will assing the address to the file yoou like.

p.s.:
Consider using "object" instead of "embed'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.