Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16480 > unrolled thread
| Started by | "jmrw" <jmrw@free.fr> |
|---|---|
| First post | 2012-10-08 20:06 +0200 |
| Last post | 2012-10-15 12:32 -0700 |
| Articles | 16 — 4 participants |
Back to article view | Back to comp.lang.javascript
How to play a wav file when a button is pressed under Firefox. "jmrw" <jmrw@free.fr> - 2012-10-08 20:06 +0200
birthday's gift to my "jmrw" <jmrw@free.fr> - 2012-10-08 22:24 +0200
Re: birthday's gift to my Danny <dann90038@gmail.com> - 2012-10-08 13:32 -0700
Re: birthday's gift to my "jmrw" <jmrw@free.fr> - 2012-10-08 22:35 +0200
Re: birthday's gift to my "jmrw" <jmrw@free.fr> - 2012-10-10 15:53 +0200
So my girlfriend won't marry me :( "jmrw" <jmrw@free.fr> - 2012-10-10 23:13 +0200
Re: So my girlfriend won't marry me :( Danny <dann90038@gmail.com> - 2012-10-10 14:51 -0700
I am not clever "jmrw" <jmrw@free.fr> - 2012-10-11 16:12 +0200
Re: I am not clever Danny <dann90038@gmail.com> - 2012-10-11 12:28 -0700
Re: How to play a wav file when a button is pressed under Firefox. "jmrw" <jmrw@free.fr> - 2012-10-14 19:58 +0200
Re: How to play a wav file when a button is pressed under Firefox. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-10-14 22:09 +0200
Still a problem under Internet Explorer "jmrw" <jmrw@free.fr> - 2012-10-15 13:49 +0200
Ignore the precedent message please "jmrw" <jmrw@free.fr> - 2012-10-15 13:57 +0200
Re: Still a problem under Internet Explorer "jmrw" <jmrw@free.fr> - 2012-10-15 14:04 +0200
The problem is solved "jmrw" <jmrw@free.fr> - 2012-10-15 20:31 +0200
Re: The problem is solved dann90038@gmail.com - 2012-10-15 12:32 -0700
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-08 20:06 +0200 |
| Subject | How to play a wav file when a button is pressed under Firefox. |
| Message-ID | <50731606$0$6114$426a74cc@news.free.fr> |
On my page http://www.jmrw.com/Chess/Tableau_echecs/index.htm
I would like to play a small wav file each time a button is pressed.
Up to now, I have
<BGSOUND id="BGSOUND_ID" LOOP=1 SRC="jsilence.mid" />
with the function
function playSound() {
{document.all['BGSOUND_ID'].src='../sons/Back.wav';}
}
But it works only under Internet Explorer.
Could you give me a hint on a solution which would work on Firefox too?
Thanks in advance.
jmrw
[toc] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-08 22:24 +0200 |
| Subject | birthday's gift to my |
| Message-ID | <50733660$0$16478$426a74cc@news.free.fr> |
| In reply to | #16480 |
I want to say that I made this slideshow as a birthday's gift to my girlfriend. If I want her to marry me it must be perfect. So if you have ideas to improve it give them! As soon this slidshowe will be finished, I will retire from javascript. jmrw
[toc] | [prev] | [next] | [standalone]
| From | Danny <dann90038@gmail.com> |
|---|---|
| Date | 2012-10-08 13:32 -0700 |
| Subject | Re: birthday's gift to my |
| Message-ID | <19deee17-c251-49ba-b32f-6bfbe78401ce@googlegroups.com> |
| In reply to | #16488 |
ahemm, ok check -> http://www.webdevout.net/test?0C&raw I hope you like the tune :P
[toc] | [prev] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-08 22:35 +0200 |
| Subject | Re: birthday's gift to my |
| Message-ID | <507338fe$0$6139$426a74cc@news.free.fr> |
| In reply to | #16489 |
"Danny" <dann90038@gmail.com> a écrit dans le message de news: 19deee17-c251-49ba-b32f-6bfbe78401ce@googlegroups.com... > ahemm, ok check -> http://www.webdevout.net/test?0C&raw > > I hope you like the tune :P The Tune is fantatisc. You too Thanks
[toc] | [prev] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-10 15:53 +0200 |
| Subject | Re: birthday's gift to my |
| Message-ID | <50757dc5$0$6467$426a74cc@news.free.fr> |
| In reply to | #16489 |
I have been a bit quick Your solution seems toworks under Internet Explorer but not under Firefox. jmrw
[toc] | [prev] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-10 23:13 +0200 |
| Subject | So my girlfriend won't marry me :( |
| Message-ID | <5075e4d8$0$1986$426a34cc@news.free.fr> |
| In reply to | #16529 |
> Your solution seems toworks under Internet Explorer but not under Firefox. jmrw
[toc] | [prev] | [next] | [standalone]
| From | Danny <dann90038@gmail.com> |
|---|---|
| Date | 2012-10-10 14:51 -0700 |
| Subject | Re: So my girlfriend won't marry me :( |
| Message-ID | <ea37e4a1-759b-42df-b43e-50b82acfc54a@googlegroups.com> |
| In reply to | #16543 |
https://developer.mozilla.org/en-US/docs/Media_formats_supported_by_the_audio_and_video_elements <---- use an .ogg with an alternate .wav or so :) google chrome does mp3's too, test it .ogg in opera/ff/chrome, worked fine too.
[toc] | [prev] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-11 16:12 +0200 |
| Subject | I am not clever |
| Message-ID | <5076d3b4$0$1692$426a74cc@news.free.fr> |
| In reply to | #16545 |
"Danny" <dann90038@gmail.com> a écrit dans le message de news: ea37e4a1-759b-42df-b43e-50b82acfc54a@googlegroups.com... > https://developer.mozilla.org/en-US/docs/Media_formats_supported_by_the_audio_and_video_elements > <---- > > use an .ogg with an alternate .wav or so :) > > google chrome does > https://developer.mozilla.org/en-US/docs/Media_formats_supported_by_the_audio_and_video_elements > <---- > > > google chrome does mp3's too, test it .ogg in opera/ff/chrome, worked fine > too. http://www.jmrw.com/Chess/Tableau_echecs/index.htm > use an .ogg with an alternate .wav or so :) I want to play the sound '../sons/Back.wav' when a button is pressed. What code I have to put for it works ? Thanks jmrw (quite new to javascritpt and will never be old to it)
[toc] | [prev] | [next] | [standalone]
| From | Danny <dann90038@gmail.com> |
|---|---|
| Date | 2012-10-11 12:28 -0700 |
| Subject | Re: I am not clever |
| Message-ID | <346c2f09-7796-4a74-b225-e91cf0515cea@googlegroups.com> |
| In reply to | #16559 |
usually, the browser will play .wav natively, it can also play .mp3's and other formats if it has a plugin installed for it, the compatibilitiy issue that shows in the url I posted, is just for native playback using html5 <audio>. what code to use? well, just check the source of the example :)
[toc] | [prev] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-14 19:58 +0200 |
| Message-ID | <507afd45$0$6138$426a34cc@news.free.fr> |
| In reply to | #16480 |
I have found this code wich works under Internet Explorer and Firefox :
<div class="resultObject">
<object type="audio/x-wav" data="data/test.wav" width="200" height="20">
<param name="src" value="data/test.wav">
<param name="autoplay" value="false">
<param name="autoStart" value="0">
alt : <a href="data/test.wav">test.wav</a>
</object>
</div>
In my code http://www.jmrw.com/Chess/Tableau_echecs/index.htm,
I have the function function playSound() {} wich is called each time a
button is pressed.
What do I have to put between the {} to play the sound ?
I AM A BEGINNER IN JAVASCRIPT.
Thanks
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2012-10-14 22:09 +0200 |
| Message-ID | <XnsA0ECE1759E6C6eejj99@194.109.133.133> |
| In reply to | #16636 |
jmrw wrote on 14 okt 2012 in comp.lang.javascript:
> I
Who is "I"?
Please use a signature on usenet.
> have found this code wich works under Internet Explorer and Firefox
> :
>
> <div class="resultObject">
> <object type="audio/x-wav" data="data/test.wav" width="200"
> height="20">
> <param name="src" value="data/test.wav">
> <param name="autoplay" value="false">
> <param name="autoStart" value="0">
> alt : <a href="data/test.wav">test.wav</a>
> </object>
> </div>
>
>
> In my code http://www.jmrw.com/Chess/Tableau_echecs/index.htm,
>
> I have the function function playSound() {} wich is called each time a
> button is pressed.
>
> What do I have to put between the {} to play the sound ?
If you only use HTML5, things become so simple:
=================================
<!DOCTYPE HTML>
<audio src='myMp3.mp3' id='aud'></audio>
<script type='text/javascript'>
var audio = document.getElementById("aud");
</script>
<button onclick='audio.play();'>play</button>
<button onclick='audio.pause();'>pause</button>
<button onclick='audio.currentTime=0;audio.play();'>restart</button>
=================================
>
> I AM A BEGINNER IN JAVASCRIPT.
Yes?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-15 13:49 +0200 |
| Subject | Still a problem under Internet Explorer |
| Message-ID | <507bf961$0$16493$426a74cc@news.free.fr> |
| In reply to | #16637 |
>Who is "I"?
>Please use a signature on usenet.
What is a signature on usenet?
-------------------------
http://www.jmrw.com/Chess/Tableau_echecs/index.htm
This is my code simplifed :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>Chess Paintings</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Tableaux échecs - Chess Paintings - Schach
in der Kunst - Scacchi e Arte - Pintura y ajedrez - schaak kunst" />
<link rel="shortcut icon" href="../Favicon.ico" />
<audio src='data/Image_suivante.wav' id='aud'></audio>
<script type="text/javascript">
var
audio = document.getElementById("aud");
play = true, playrandom = false, backward = false,
nbchrono = Math.round((listeOeuvres.length)/6)
tempo = 20000, // délai entre images (en millisecondes)
Compteur = -1,
quantite=1,
Numero = 0;
function diaporamarandom() {
audio.play();Compteur=Math.floor(Math.random()*nbchrono);
document.getElementById('quantite').value = Compteur;
Numero=(listeOeuvres[6*Compteur] - 1000) + ""; if (Numero.length == 1)
Numero = "000" + Numero; if (Numero.length == 2) Numero = "00" + Numero;
if (Numero.length == 3) Numero = "0" + Numero;
document.getElementById('vue').style.backgroundImage = 'url(images/'+ Numero
+ '.jpg)'; // changement de l'image de background
document.getElementById('legende').innerHTML = "";//Nom_Artiste +
" "+ Date_Naissance + "  " + Date_Deces +
" " + Titre + " "+
Date_Oeuvre ;}
fill_div();
play = setTimeout('diaporamarandom()',tempo); // relance du diaporama dans
'tempo' millisecondes
}
function diaporamachrono() {
audio.play();
Compteur++; if(Compteur >= nbchrono) Compteur=0;
document.getElementById('quantite').value = Compteur;
Numero=(listeOeuvres[6*Compteur] - 1000) + ""; if (Numero.length == 1)
Numero = "000" + Numero; if (Numero.length == 2) Numero = "00" + Numero;
if (Numero.length == 3) Numero = "0" + Numero;
document.getElementById('vue').style.backgroundImage = 'url(images/' +
Numero + '.jpg)'; // changement de l'image de background
fill_div();
play = setTimeout('diaporamachrono()',tempo); // relance du diaporama dans
'tempo' millisecondes
}
function diaporamachronoreverse() {
audio.play();Compteur=Compteur-1; if(Compteur < 0) Compteur=nbchrono-1;
document.getElementById('quantite').value = Compteur;
Numero=(listeOeuvres[6*Compteur] - 1000) + ""; if (Numero.length == 1)
Numero = "000" + Numero; if (Numero.length == 2) Numero = "00" + Numero;
if (Numero.length == 3) Numero = "0" + Numero;
document.getElementById('vue').style.backgroundImage = 'url(images/' +
Numero + '.jpg)'; // changement de l'image de background
fill_div();
play = setTimeout('diaporamachronoreverse()',tempo); // relance du diaporama
dans 'tempo' millisecondes
}
function stop() { clearTimeout(play); play = false; }
function upAll(f){
var b = [];
b.push(f.updown, f.pRight, f.pLeft, f.pBoth);
for (var i=0;i<b.length;i++)
b[i].className = 'bup';
}
function fill_div() {
var Nom_Artiste ="", Date_Naissance ="", Date_Deces ="", Titre="",
Date_Oeuvre="";
Nom_Artiste = listeOeuvres[6*Compteur+1];
Date_Naissance = listeOeuvres[6*Compteur+2];
Date_Deces = listeOeuvres[6*Compteur+3]; if
(listeOeuvres[6*Compteur+3] == undefined) {Date_Deces ="----"};
Titre = listeOeuvres[6*Compteur+4];
Date_Oeuvre = listeOeuvres[6*Compteur+5]; if
(listeOeuvres[6*Compteur+5] == undefined) {Date_Oeuvre =""};
document.getElementById('legende').innerHTML = Nom_Artiste +
" "+ "º " + Date_Naissance + "  " + "? " +
Date_Deces + " " + Titre +
" "+ Date_Oeuvre ;}
</script>
<style type="text/css" title="text/css">
body { background-color: #FFFFEC;}
#vue {width: 1000px; height: 600px; margin: auto; background:
url(images/0000.jpg) no-repeat center center #FFFFEC; }
a:link {color: #993300; text-decoration: none;}a:visited {text-decoration:
none;color: #993300;}a:hover {text-decoration: none;color: #993300;}a:active
{text-decoration: none;color: #993300;}
.Style26 {font-size: 36pt; color: #993300;}
.Style27 {font-size: 12pt; color: #993300;font-weight: bolder;}
#Layer1 {position:absolute; width:50px; height:50px; z-index:1; left: 10px;
top: 10px;}
* {margin: 0; padding: 0; }
button {display: inline-block; margin: 0 1em; width: 3em; text-align:
center; border-radius: 12px; font-size: 14pt; border-color: gray}
.bdown {border: 2px inset gray;}
.bup {border: 2px outset gray;}
</style>
</head>
<body>
<a href="../Chess_Curiosities1.htm" target="_parent" class="Style9"></a>
<div align="center">
<p style="background-image:/images/001.jpg" id="vue" ></p>
<DIV class="Style27" id="legende" style="border:0px solid;width:1200px;
height:20px"></DIV>
<form onSubmit="return false">
<button name="updown" onclick=" audio.play() ; alert('Press Key F11')"
>↕</button>
<button name="pRight" onClick=" audio.play() ; upAll(this.form) ;
this.className='bdown' ; playrandom = false ; backwardúlse ;stop();
Compteur=document.getElementById('quantite').value ;
diaporamachrono()">►</button>
<button name="pLeft" onClick=" audio.play() ; upAll(this.form) ;
this.className='bdown' ; playrandom = false ; backward=true ; stop();
Compteur=document.getElementById('quantite').value ;
diaporamachronoreverse()">◄</button>
<input type=number id="quantite" name="quantite" value="-1" size="4"
maxlength="4">
<button name="pBoth" onClick=" audio.play() ; upAll(this.form) ;
this.className='bdown' ; playrandom = true ; stop() ; ; diaporamarandom();
">◄►</button>
<button name="Stop" onClick=" audio.play() ; upAll(this.form) ;
stop()">■</button>
<input name="choix" TYPE="radio" onClick="tempo 00"
value="4000"> 4s
<input name="choix" TYPE="radio" onClick="tempo@00"
value="10000"> 10s
<input name="choix" type="radio" onClick="tempo000"
value="20000" checked> 20s
<input name="choix" type="radio" onClick="tempo`000"
value="60000"> 60s
</form>
</div>
</BODY>
</html>
------------------
Under Firefox it woks fine.
Under Internet explorer I receive "Error in the page" when I click on a
button.
Where is the mistake
Thanks
jmrw
[toc] | [prev] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-15 13:57 +0200 |
| Subject | Ignore the precedent message please |
| Message-ID | <507bfa21$0$1973$426a74cc@news.free.fr> |
| In reply to | #16643 |
[toc] | [prev] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-15 14:04 +0200 |
| Subject | Re: Still a problem under Internet Explorer |
| Message-ID | <507bfbd7$0$1710$426a74cc@news.free.fr> |
| In reply to | #16643 |
>Who is "I"?
>Please use a signature on usenet.
What is a signature on usenet?
The code you gave me :
-----------------------
<!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">
<head>
<audio src='data/Image_suivante.wav' id='aud'></audio>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans nom</title>
<script type='text/javascript'>
var audio = document.getElementById("aud");
</script>
</head>
<body>
<button onclick='audio.play();'>play</button>
<button onclick='audio.pause();'>pause</button>
<button onclick='audio.currentTime=0;audio.play();'>restart</button>
</body>
</html>
-----------------------
Works fine with Firefox, but wiht Internet Explorer I get the message "Error
in the page" when I click on a button.
jmrw
[toc] | [prev] | [next] | [standalone]
| From | "jmrw" <jmrw@free.fr> |
|---|---|
| Date | 2012-10-15 20:31 +0200 |
| Subject | The problem is solved |
| Message-ID | <507c5661$0$1843$426a74cc@news.free.fr> |
| In reply to | #16643 |
You can see http://www.jmrw.com/Chess/Tableau_echecs/index.htm jmrw
[toc] | [prev] | [next] | [standalone]
| From | dann90038@gmail.com |
|---|---|
| Date | 2012-10-15 12:32 -0700 |
| Subject | Re: The problem is solved |
| Message-ID | <cd8f7c97-4964-426b-acec-a17dc1683560@googlegroups.com> |
| In reply to | #16648 |
Does that mean we in the channel get a cigar? boy meets girl, girl meets boy, girl sorta likes boy but he needs deodorant, boy change shirt, girl is unmoved, boy introduces his pet hamster, girl doesn't like rodents, boy decides to looks good by making a page with sounds, girl likes the idea, boy succeeds on making page, girl doesn't like tune, girl whacks boy with a broom. (j/k) ------------------------------------------------------------------- I'm not a teacher: only a fellow-traveller of whom you asked the way. I pointed ahead -- ahead of myself as well as you. ~~ George Bernard Shaw ~~
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web