Recuperation d'une variable qui fait tout planter HELP

benjhe Messages postés 12 Date d'inscription lundi 17 février 2003 Statut Membre Dernière intervention 9 juin 2004 - 4 juin 2004 à 11:08
cs_bultez Messages postés 13615 Date d'inscription jeudi 13 février 2003 Statut Membre Dernière intervention 15 octobre 2013 - 7 juin 2004 à 14:17
Voila je fais actuellement un site avec du streaming audio pour diffuser des radios.
J'ai un lecteur Mplayer2 et dessous des liens vers differentes radio. Lorsque l'on clique sur un lien la page se recharge avec en parametres dans la barre d'adresse, l'url que doit jouer le player. J'ai donc une fonction Javascript qui recupere l'URL de la radio grace a un substring (cette fonction marche) mais le probleme est que lorsque je veux utiliser la fonction dans le code HTML, mon page web plante et je dois avoir recours a ctrl+alt+sup.

Donc si quelqu'un c'est d'ou vient le probleme merci à lui.
Je mets le code ci dessous pour plus de comprehension

D'avance Merci et a +
BENJHE

code :

<html>

<head>
<title>
Rire et Chanson
</title>

<script language="JavaScript">
function getParms(){
if(window.location.search.length > 1)
{
var parms = window.location.search.substring(1);
var radio = parms.substring(parms.indexOf("=")+1,parms.length);
return radio;
}
else return "http://cache.yacast.fr/V4/rireetchansons/rireetchansons.asx";
}
</script>

</head>

<OBJECT ID="MMPlayer1" WIDTH="300" HEIGHT="100"
classid = "CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE = "http://activex.microsoft.com/activex/controls/mplayer
/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">

*****
---- c'est de la que vient le probleme, si je remplace javascript:document.write(getParms()) par http://cache.yacast.fr/V4/rireetchansons/rireetchansons.asx par ewemple ca marche ----
*****

</OBJECT>

[index.html?v=http://www.tv-radio.com/station/europe_2/europe_2-20k.asx Europe 2]

</html>

10 réponses

cs_bultez Messages postés 13615 Date d'inscription jeudi 13 février 2003 Statut Membre Dernière intervention 15 octobre 2013 30
4 juin 2004 à 11:19
Bonjour,
ça, ça ne doit pas fonctionner
VALUE="javascript:document.write(getParms())">
il faudrait faire en javascript
MMPlayer1.FileName=getParms();
peut-être ?
Cordialement Bul. [Site] [[mailto:marcel.Bultez@Tiscali.fr Mail]]
0
benjhe Messages postés 12 Date d'inscription lundi 17 février 2003 Statut Membre Dernière intervention 9 juin 2004
4 juin 2004 à 11:27
Ca marche po :'(

Mais merci quand meme
0
cs_bultez Messages postés 13615 Date d'inscription jeudi 13 février 2003 Statut Membre Dernière intervention 15 octobre 2013 30
4 juin 2004 à 11:41
fait où et comment ?
Cordialement Bul. [Site] [[mailto:marcel.Bultez@Tiscali.fr Mail]]
0
benjhe Messages postés 12 Date d'inscription lundi 17 février 2003 Statut Membre Dernière intervention 9 juin 2004
4 juin 2004 à 12:05
Bah a la place de
j'ai mis :

<SCRIPT>
MMPlayer1.FileName=getParms();
</SCRIPT>

Je sais pas si c'est bon mais en tout cas ca marche po.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_bultez Messages postés 13615 Date d'inscription jeudi 13 février 2003 Statut Membre Dernière intervention 15 octobre 2013 30
4 juin 2004 à 12:44
ça ça marche sans planter
<html>
<head>
<title>
Rire et Chanson
</title>
<script type="text/JavaScript">
function getParms(){
if(window.location.search.length > 1)
{
var parms = window.location.search.substring(1);
var radio = parms.substring(parms.indexOf("=")+1,parms.length);
return radio;
}
else return "http://cache.yacast.fr/V4/rireetchansons/rireetchansons.asx";
}
</script>
</head>

<OBJECT ID="MMPlayer1" WIDTH="300" HEIGHT="100" 
classid = "CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 
CODEBASE = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components..." 
type="application/x-oleobject">

</OBJECT>

[index.html?v=http://www.tv-radio.com/station/europe_2/europe_2-20k.asx 
Europe 2]
<script type="text/javascript">
MMPlayer1.FileName=getParms();
</script>

</html> 

je ne sais pas si c'est ce qu'il fallait faire,
parce qu'il y avait plus "simple" que de
recharger la page, mais ....
ce serait sympa de nous donner les
adresses des radios possibles.
Cordialement Bul. [Site] [[mailto:marcel.Bultez@Tiscali.fr Mail]]
0
benjhe Messages postés 12 Date d'inscription lundi 17 février 2003 Statut Membre Dernière intervention 9 juin 2004
4 juin 2004 à 13:41
Merci ca marche t un genie...

Y'avait plus simple cad parce que je debute en javascript...

Sinon pour les adresses de radio alors :

- Radio BFM : 'http://www.comfm.com/live/radio/bfm/bfm.asx'
- France Info : 'http://cache.yacast.fr/V4/franceinfo/franceinfo.asx'
- Fun Radio : 'http://cache.yacast.fr/V4/fun/fun.asx'
- NRJ : 'http://cache.yacast.fr/V4/nrj/nrj.asx'
- Skyrock : 'http://cache.yacast.fr/V4/skyrock/skyrock.asx'
- Europe 1 : 'http://cache.yacast.fr/V4/europe1/europe1.asx'
- RTL : 'http://cache.yacast.fr/V4/rtl/rtl.asx'
- RTL 2 : 'http://cache.yacast.fr/V4/rtl2/rtl2.asx'
- CKMF : 'http://www.radioenergie.com/radioendirect/ckmf.asx'
- Contact (belgique) : 'http://www.radiocontact.be/fr/Player/streamingRCFR.asx'
- Rire et chanson : 'http://cache.yacast.fr/V4/rireetchansons/rireetchansons.asx'
- One FM : 'http://212.23.249.202/OnefmAudio.asx'
- RFM : 'http://www.tv-radio.com/station/rfm/rfm-20k.asx'
- Europe 2 : 'http://www.tv-radio.com/station/europe_2/europe_2-20k.asx'
- France Inter : 'http://cache.yacast.fr/V4/franceinter/franceinter.asx'
- RMC : 'http://cache.yacast.fr/V4/rmc/rmc.asx'
- Cherie FM : 'http://player.cheriefm.fr/V4/cheriefm/cheriefm.asx'
- Nostalgie : 'http://player.nostalgie.fr/V4/nostalgie/nostalgie.asx'
- OUI FM : 'http://cache.yacast.fr/V4/ouifm/ouifm.asx'
- Contact FM : 'http://www.tv-radio.com/live/asx/contactfm.asx'
- Vibration : 'http://www.tv-radio.com/cgi-bin/tagger.pl?tag=site&metafile=vibration/vibration-20k.asx'

sinon tu peux en trouver plein a l'adresse : http://web1.shoutcast.com/newwaradio.phtml (winamp)

Je n'ai pas encore testé toutes les radios je ne garantit pas qu'elles fonctionnent toutes.

Merci beaucoup pour ton aide et a charge de revanche...

+++
BENJHE
0
cs_bultez Messages postés 13615 Date d'inscription jeudi 13 février 2003 Statut Membre Dernière intervention 15 octobre 2013 30
4 juin 2004 à 15:11
je viens de me rendre compte que
chez moi, ça plante au bout de quelques secondes
pas chez toi ?
et même avec d'autres langages que javascript
la simplification [ par exemple, sans relancer ] :
<html>
<head>
<title>Radios</title>
</head>

<OBJECT name="ObjSonWav" id="ObjSonWav"
        VIEWASTEXT
CLASSID="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
</OBJECT>
<select name=radio
        size=5
        onchange="ObjSonWav.FileName=this.options(this.selectedIndex).value;">
<option value="http://www.tv-radio.com/station/europe_2/europe_2-20k.asx">
Europe 2
<option value="http://cache.yacast.fr/V4/rireetchansons/rireetchansons.asx">
Rires et Chansons
</select>
</html> 

j'ai eu des difficultés à me connecter.
Cordialement Bul. [Site] [[mailto:marcel.Bultez@Tiscali.fr Mail]]
0
benjhe Messages postés 12 Date d'inscription lundi 17 février 2003 Statut Membre Dernière intervention 9 juin 2004
7 juin 2004 à 09:25
non chez moi ca plante pas...
Ca a du mal a mettre en memoire tampon malgres le 2048 mais sinon apres ca marche.

Je vais tester ton code.

Merci a +
0
benjhe Messages postés 12 Date d'inscription lundi 17 février 2003 Statut Membre Dernière intervention 9 juin 2004
7 juin 2004 à 09:29
ton code marche nikel merci
0
cs_bultez Messages postés 13615 Date d'inscription jeudi 13 février 2003 Statut Membre Dernière intervention 15 octobre 2013 30
7 juin 2004 à 14:17
après mise à jour de windows media player
tout fonctionne maintenant sans problème.
je vais mettre ça dans les sources pour
en faire profiter tout le monde.
Cordialement Bul. [Site] [[mailto:marcel.Bultez@Tiscali.fr Mail]]
0
Rejoignez-nous