bonjour @ tous
voici mon probleme !
J'insere un player de mp3 en flash dans une page web !
jusque l�, rien de bien compliqu�
ce player permet l'utlisation de javascript pour mettre en pause, regler le volume,....!
Voici donc ma page qui fonctionne !Jusque l� tout va bien, mais c'est maintenant que mon probleme se devoile
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Flash MP3 Player - Javascript Control Examples</title> </head> <body style="margin:50px;"> <h2>Javascript control examples.<br />Check the source code for a small explanation.<br />Won´t work locally due to Flash security restrictions! Test online...</h2> <!-- these are all needed javascript functions --> <script> function sendEvent(typ,prm) { thisMovie("mediaplayer").sendEvent(typ,prm); } function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName] } else { return document[movieName] } } function getUpdate(typ,pr1,pr2) { var id = document.getElementById(typ); id.innerHTML = typ+ ": "+Math.round(pr1); pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2); } </script> <!-- this is the embed code for the mp3player --> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="150" id="mediaplayer" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" > <param name="movie" value="mp3player.swf?file=playlist.php" /> <param nam="allowScriptAccess" value="always"> <embed src="mp3player.swf?file=playlist.php" allowScriptAccess="always" width="300" height="150" name="mediaplayer" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> <!-- this list contains an example of each javascript control --> <h3>Send Events:</h3> <ul> <li><a href="javascript:sendEvent('playpause')">Toggle the pause state.</a></li> <li><a href="javascript:sendEvent('scrub',25)">Scrub to 25 percent inside the song</a></li> <li><a href="javascript:sendEvent('playitem',1)">Play the 2nd song of the playlist</a></li> <li><a href="javascript:sendEvent('getlink',1)">Go to the 2nd link from the playlist</a></li> <li><a href="javascript:sendEvent('volume',50)">set the volume to 50%</a></li> </ul> <h3>Received Updates:</h3> <ul> <li id="volume"></li> <li id="state"></li> <li id="time"></li> <li id="load"></li> <li id="item"></li> </ul> </body> </html>![]()
Je dois deplacer le lecteur sur une autre page (iframe) mais je dois aussi conserver les commandes javascrpt sur cette page !
Et donc bien evidemment le javascript ne fonctionne plus puisque le lecteur se trouve sur une autre page
Voici la page principale :
et voici l'iframe qui contien le player
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Flash MP3 Player - Javascript Control Examples</title> </head> <body style="margin:50px;"> <h2>Javascript control examples.<br />Check the source code for a small explanation.<br />Won´t work locally due to Flash security restrictions! Test online...</h2> <!-- these are all needed javascript functions --> <script> function sendEvent(typ,prm) { thisMovie("mediaplayer").sendEvent(typ,prm); } function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName] } else { return document[movieName] } } function getUpdate(typ,pr1,pr2) { var id = document.getElementById(typ); id.innerHTML = typ+ ": "+Math.round(pr1); pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2); } </script> <iframe id="test1" name="tes1" src="player.php"> </iframe> <!-- this is the embed code for the mp3player --> <!-- this list contains an example of each javascript control --> <h3>Send Events:</h3> <ul> <li><a href="javascript:sendEvent('playpause')">Toggle the pause state.</a></li> <li><a href="javascript:sendEvent('scrub',25)">Scrub to 25 percent inside the song</a></li> <li><a href="javascript:sendEvent('playitem',1)">Play the 2nd song of the playlist</a></li> <li><a href="javascript:sendEvent('getlink',1)">Go to the 2nd link from the playlist</a></li> <li><a href="javascript:sendEvent('volume',50)">set the volume to 50%</a></li> </ul> <h3>Received Updates:</h3> <ul> <li id="volume"></li> <li id="state"></li> <li id="time"></li> <li id="load"></li> <li id="item"></li> </ul> </body> </html>
Il faut donc modifier la balise javascript suivante :
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7 <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="150" id="mediaplayer" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" > <param name="movie" value="mp3player.swf?file=playlist.php" /> <param nam="allowScriptAccess" value="always"> <embed src="mp3player.swf?file=playlist.php" allowScriptAccess="always" width="300" height="150" name="mediaplayer" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>
Afin de faire pointer ce script vers la nouvelle page (player.php) contenu dans l'iframe "test1"
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 <script> function sendEvent(typ,prm) { thisMovie("mediaplayer").sendEvent(typ,prm); } function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName] } else { return document[movieName] } } function getUpdate(typ,pr1,pr2) { var id = document.getElementById(typ); id.innerHTML = typ+ ": "+Math.round(pr1); pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2); } </script>
Mais vraiment je ne comprend pas comment modifier mon JS!
Toutes mes tentatives ont aboutis sur un echec cuisant![]()
![]()
Merci d'avance![]()
Partager