LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 12-12-2011, 11:16 AM   #1
joboy
Member
 
Registered: Jul 2009
Distribution: Debian, Ubuntu, Puppy, Mint
Posts: 655

Rep: Reputation: 7
Media playback problem on web page


Hi there,

I want to embed midi music into a page, I wrote a simple script to randomly play a midi file each time the page is loaded, and I use the meta tag refresh the page after a delay, this is very basic but at least it works on Firefox, Konqueror and Chrome, but Opera does not play the sound.

================================================================================
<script type="text/javascript" language="javascript"
src="script/music.js"></script>
================================================================================

[Music script #1]

================================================================================
function rand(num)
{
return Math.floor(Math.random()*num)+1;
}
document.write("<embed src=audio/"+rand(31)+".mid"+" hidden=true autostart=true volume=100 loop=no>"+"</embed>");
================================================================================

The problem is, FF only play the music once, no sound after the refresh, but Konqueror and Chrome play after refresh. I then try another script.

[Music script #2]

================================================================================
function rand(num)
{
return Math.floor(Math.random()*num)+1
}
document.write('<object data="audio"+rand(17)+".mid" width="0" height="0" hidden="yes">');
document.write('<param name="controller" value="false">');
document.write('<param name="autoplay" value="yes">');
document.write('<param name="volume" value="100">');
document.write('</object>');
================================================================================

But the above script is not recognized by all browser, any idea ?
 
Old 12-13-2011, 11:03 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
Seems like you probably wanted this topic in the Programming forum so it get's the appropriate attention; a moderator can move it for you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
executing linux commands from web page and outputing it back to the web page ashes_sheldon Programming 9 02-28-2015 12:07 AM
Web Page Problem Displaying Image metallica1973 Linux - Software 1 10-06-2008 08:42 PM
Free embedded media player for a web page Mr. Swillis Linux - Server 1 02-24-2008 06:33 PM
apache web page authentication problem jitheshmurali Linux - General 3 04-01-2006 02:51 PM
strange web page problem dsiguy Linux - General 3 02-19-2003 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 02:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration