source: spip-zone/_plugins_/soundmanager/player360.js.html @ 106667

Last change on this file since 106667 was 106667, checked in by booz@…, 2 years ago

une classe quand le son joue sur le bouton annexe

File size: 2.9 KB
Line 
1#HTTP_HEADER{Content-Type: text/javascript}
2#CACHE{24*3600,cache-client}
3
4soundManager.setup({
5        url: '[(#CHEMIN{swf/soundmanager2.swf}|url_absolue|dirname)/]',
6        flashVersion: 9, // optional: shiny features (default = 8)
7        useFlashBlock: false, // optionally, enable when you're ready to dive in
8        debugMode: false
9});
10
11threeSixtyPlayer.config.scaleFont = (navigator.userAgent.match(/msie/i)?false:true);
12threeSixtyPlayer.config.showHMSTime = true;
13
14// enable some spectrum stuffs
15
16threeSixtyPlayer.config.useWaveformData = true;
17threeSixtyPlayer.config.useEQData = true;
18
19// enable this in SM2 as well, as needed
20
21if (threeSixtyPlayer.config.useWaveformData) {
22  soundManager.flash9Options.useWaveformData = true;
23}
24if (threeSixtyPlayer.config.useEQData) {
25  soundManager.flash9Options.useEQData = true;
26}
27if (threeSixtyPlayer.config.usePeakData) {
28  soundManager.flash9Options.usePeakData = true;
29}
30
31if (threeSixtyPlayer.config.useWaveformData || threeSixtyPlayer.flash9Options.useEQData || threeSixtyPlayer.flash9Options.usePeakData) {
32  // even if HTML5 supports MP3, prefer flash so the visualization features can be used.
33  soundManager.preferFlash = true;
34}
35
36
37
38$(document).ready(function(){
39
40        function maj_bouton_play_pause(){
41                if($("button.play_pause").text() === "pause"){
42                        $("button.play_pause").removeClass("bouton_playing").html("play") ;
43                }else{
44                        $("button.play_pause").addClass("bouton_playing").html("pause") ;
45                }
46        }
47       
48        // surcharge des events play/pause/finish : https://stackoverflow.com/questions/10127009/soundmanager2-onplay-event-configuration-does-not-work
49        var onplay360 = threeSixtyPlayer.events.play;
50        var myOnplay = function(){
51                //console.log("play");
52                maj_bouton_play_pause();
53                onplay360.apply(this); // forces the scope to 'this' = the sound object
54        };
55        threeSixtyPlayer.events.play = myOnplay;
56       
57        var onpause360 = threeSixtyPlayer.events.pause;
58        var myOnpause = function(){
59                //console.log("pause");
60                maj_bouton_play_pause();
61                onpause360.apply(this); // forces the scope to 'this' = the sound object
62        };
63        threeSixtyPlayer.events.pause = myOnpause;
64       
65        var onresume360 = threeSixtyPlayer.events.resume;
66        var myOnresume = function(){
67                //console.log("resume");
68                maj_bouton_play_pause();
69                onresume360.apply(this); // forces the scope to 'this' = the sound object
70        };
71        threeSixtyPlayer.events.resume = myOnresume;
72       
73        var onfinish360 = threeSixtyPlayer.events.finish;
74        var myOnfinish = function(){
75                //console.log("finish");
76                maj_bouton_play_pause();
77                onfinish360.apply(this); // forces the scope to 'this' = the sound object
78        };
79        threeSixtyPlayer.events.finish = myOnfinish;
80
81        // y'a t'il un son ?
82        if($(".ui360").size() > 0){
83                $("button.play_pause").click(function(){
84                        // son déjà chargé ?
85                        if(typeof soundManager.getSoundById("ui360Sound0") == "undefined"){
86                                $(".sm2-360btn").eq(0).click();
87                        }else{
88                                soundManager.togglePause("ui360Sound0");
89                        }
90                });
91        }
92
93});
Note: See TracBrowser for help on using the repository browser.