<?xml version='1.0' encoding='UTF-8'?><uidget><metadata><name>Music</name><description>Add a music/sound player</description><help><![CDATA[Display a Sound Player for your visitors to listen to one of your favorite musics and sounds.]]></help><api_version>1.0</api_version><size height='32' width='300' /><blog en='60' /></metadata><view><content>&lt;div&gt;
	&lt;div class=playpause_button&gt;&lt;/div&gt;
	&lt;div class=volume_bar&gt;
		&lt;div class=current_volume&gt;&lt;/div&gt;
		&lt;div class=volume_bar_setter&gt;&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class=peak_bar&gt;
		&lt;div class=peak_value&gt;&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class=seek_bar_position&gt;&lt;/div&gt;
	&lt;div class=seek_bar&gt;
		&lt;div class=loaded_bar&gt;&lt;/div&gt;
		&lt;div class=played_bar&gt;&lt;/div&gt;
		&lt;div class=seek_bar_setter&gt;&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class=duration&gt;&lt;/div&gt;
	&lt;div class=infos&gt;&lt;div class=infos_scroll&gt;&lt;div class=artist&gt;&lt;/div&gt;&lt;div class=title&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;</content><properties><sound_selector default='{id:-1,name:&apos;3255_[Luc_Ange_Essilopal]_Eau_minerale_gazeuse_[Creative_Commons___by_2.0]_[www.dogmazic.net].mp3&apos;,url:&apos;/components/UI_Music/3255_[Luc_Ange_Essilopal]_Eau_minerale_gazeuse_[Creative_Commons___by_2.0]_[www.dogmazic.net].mp3&apos;}' default_action='true' help='Choose a sound to add to the player. One song by player.' icon='folder' name='sound' /><checkbox default='true' help='If checked, the track is paused when visitors switch to another page.&lt;br&gt;Disable this function if you want to add an ambient sound to your website. You can also add this block to your background page to achieve this function, as it will appear on all the pages.' name='pauseonpagechange' value='Pause on page change' /><checkbox default='false' help='If checked, the track will restart at the beginning after reaching its end.' name='loop' value='Loop' /><checkbox class='uim_prop_sitew' default='false' help='If checked, a volume controller will be displayed.' name='volume_bar' value='Volume' /><checkbox class='uim_prop_sitew' default='false' help='Only on PC. If checked, a small equalizer will be displayed.' name='peak_bar' value='Equalizer' /><checkbox class='uim_prop_sitew' default='true' help='If checked, a seek bar will be displayed. It shows the sound loading progress and the current position in the track. By clicking on the bar, you can go to an arbitrary position.' name='seek_bar' value='Seek bar' /><checkbox class='uim_prop_sitew' default='true' help='Only on PC. If checked, the artist name will be shown after the first playback. It is taken from the id3 tag of the mp3 file.' name='artist' value='Artist' /><checkbox class='uim_prop_sitew' default='true' help='Only on PC. If checked, the track title will be shown after the first playback. It is taken from the id3 tag of the mp3 file.' name='title' value='Title' /><checkbox class='uim_prop_sitew' default='true' help='If checked, the track duration and the position in the track will be shown after the first playback.' name='duration' value='Duration' /><checkbox class='uim_prop_sc' default='true' help='If checked and the track can be bought, a buy button will be displayed.' name='buying' value='Buying button' /><checkbox class='uim_prop_sc' default='true' help='If checked and sharing is activated, a like button will be displayed.' name='liking' value='Liking button' /><checkbox class='uim_prop_sc' default='true' help='If checked and the track can be downloaded, a download button will be displayed.' name='download' value='Download button' /><checkbox class='uim_prop_sc' default='true' help='If checked, track artwork will be displayed.' name='artwork' value='Artwork' /><checkbox class='uim_prop_sc' default='true' help='If checked, comments will be displayed.' name='comments' value='Comments' /><checkbox class='uim_prop_sc' default='true' help='If checked, number of track plays will be displayed.' name='counts' value='Play counts' /><checkbox class='uim_prop_sc' default='true' help='If checked, uploader name will be displayed.' name='user' value='User' /><hidden default='false' name='next' /><hidden default='false' name='previous' /><hidden default='false' name='random_btn' /><hidden default='false' name='random' /><hidden default='false' name='loop_btn' /></properties></view><script>$.ajax({url:cdn_url(&quot;/assets/precompile/soundmanager-2.js?v2&quot;),dataType:&quot;script&quot;,cache:true,simple_ajax:true,success:function(){var a=getFlashVersion();
var b;
if(a==&quot;&quot;){a=&quot;0&quot;
}if(parseFloat(a)&lt;9){b=8
}else{b=9
}soundManager.setup({flashVersion:b,preferFlash:false,url:&quot;/assets/lib/soundmanagerv297a-20170601/swf/&quot;,onready:function(){sigCtl.emitVariable(&quot;soundManager.ready&quot;)
}});
soundManager.beginDelayedInit()
}});
UI_List.UI_Music={initialize:function(a){$.each([&quot;buying&quot;,&quot;sharing&quot;,&quot;download&quot;,&quot;artwork&quot;,&quot;counts&quot;,&quot;comments&quot;,&quot;show_user&quot;],function(b,c){if(a.data&amp;&amp;a.data[c]===undefined){a.data[c]=true
}});
this.cpt=a;
a.setOptions([&quot;locked&quot;,&quot;footer&quot;])
},onDisplay:function(b){this.node=b;
this.currentSound=null;
this.scrollInterval=null;
var a=this;
this.playing=true;
this.pause();
sigCtl.connect(&quot;soundManager.volume&quot;,function(d,c){$(&quot;.current_volume&quot;,b).height(&quot;&quot;+c+&quot;%&quot;)
});
sigCtl.getVariable(&quot;soundManager.ready&quot;,function(){try{a.initSound()
}catch(c){console.log(&quot;exp music&quot;,c)
}});
sigCtl.connect(&quot;soundManager.pauseAll&quot;,function(){a.pause(true)
});
$(&quot;.playpause_button&quot;,b).click(function(){if(a.playing){a.pause()
}else{a.play()
}});
$(&quot;.seek_bar_setter&quot;,b).click(function(d){var c=a.currentSound.durationEstimate*(d.originalEvent.layerX||d.originalEvent.offsetX)/$(&quot;.seek_bar&quot;,b).width();
a.currentSound.setPosition(c)
});
this.current_volume=this.cpt.data.init_volume||100;
sigCtl.emit(&quot;soundManager.volume&quot;,this.current_volume);
$(&quot;.volume_bar_setter&quot;,b).click(function(d){var c=100*($(&quot;.volume_bar&quot;,b).height()-(d.originalEvent.layerY||d.originalEvent.offsetY))/$(&quot;.volume_bar&quot;,b).height();
this.current_volume=c;
a.currentSound.setVolume(c);
sigCtl.emit(&quot;soundManager.volume&quot;,c);
if(v.mode==&quot;editor&quot;){a.cpt.setData(&quot;init_volume&quot;,c)
}});
this.updateSize()
},initSound:function(){try{if(this._firstSound()){var b=this;
var e=$(&quot;.loaded_bar&quot;,b.node);
var f=$(&quot;.played_bar&quot;,b.node);
var c=$(&quot;.peak_value&quot;,b.node);
var a=$(&quot;div:first&quot;,b.node);
this.position=-1000;
if(this._firstSound().api==&quot;sc&quot;||this._firstSound().api==&quot;soundcloud&quot;){Apis.soundcloud_player(function(){var i=$(&quot;iframe&quot;,b.node);
if(i.length==0){i=$(&apos;&lt;iframe frameborder=&quot;no&quot; scrolling=&quot;no&quot; src=&quot;https://w.soundcloud.com/player/?url=&apos;+encodeURIComponent(b._firstSound().url)+&apos;&amp;show_artwork=true&quot;&gt;&lt;/iframe&gt;&apos;).insertAfter(a.hide())
}i.width(b.cpt.W()).height(b.cpt.H());
var h=SC.Widget(i.get(0));
var g={auto_play:b.cpt.data.autostart,buying:b.cpt.data.buying,sharing:b.cpt.data.sharing,download:b.cpt.data.download,show_artwork:b.cpt.data.artwork,show_playcount:b.cpt.data.counts,show_comments:b.cpt.data.comments,show_user:b.cpt.data.show_user};
h.load(b._firstSound().url,g);
if(b.cpt.data.loop||b.cpt.data.sound.length&gt;1){h.unbind(SC.Widget.Events.FINISH);
h.bind(SC.Widget.Events.FINISH,function(j,k){if(b.cpt.data.sound.length==1){h.play()
}else{h.isPaused(function(l){if(l){b.sound_num=(b.sound_num||0)+1;
if(b.sound_num&gt;b.cpt.data.sound.length-1){b.sound_num=0
}g.auto_play=true;
h.load(b.cpt.data.sound[b.sound_num].url,g)
}})
}})
}})
}else{$(&quot;iframe&quot;,b.node).remove();
a.show();
this.currentSound=soundManager.createSound({id:&quot;z&quot;+this.cpt.component_type.getCounter(),url:this._firstSound().url,usePeakData:true,whileloading:function(){if(b.currentSound.bytesTotal&gt;0){e.width(&quot;&quot;+(100*b.currentSound.bytesLoaded/b.currentSound.bytesTotal)+&quot;%&quot;);
clearTimeout(b.not_working_autostart)
}},whileplaying:function(){c.height(&quot;&quot;+b.currentSound.peakData.left*100+&quot;%&quot;);
if(b.position&gt;&gt;10!=b.currentSound.position&gt;&gt;10){b.position=b.currentSound.position;
if(b.currentSound.durationEstimate&gt;0){f.width(&quot;&quot;+(100*b.currentSound.position/b.currentSound.durationEstimate)+&quot;%&quot;)
}function g(n){var l=&quot;&quot;;
var k=Math.floor(n/3600000);
var i=Math.floor((n-k*3600000)/60000);
var j=Math.floor((n-k*3600000-i*60000)/1000);
if(k&gt;0){l+=k.toString()+&quot;:&quot;
}return l+sprintf(&quot;%d:%02d&quot;,i,j)
}$(&quot;.duration&quot;,b.node).text(g(b.currentSound.position)+&quot;/&quot;+g(b.currentSound.durationEstimate))
}if(b.currentSound.position&gt;0){clearTimeout(b.not_working_autostart)
}},onfinish:function(){if(!b.cpt.data.loop){b.pause()
}b.initSound()
},onid3:function(){var g=b.currentSound.id3;
$(&quot;.artist&quot;,b.node).text(g.artist||g.TPE1);
$(&quot;.title&quot;,b.node).text(g.songname||g.TIT2);
b.updateInfosScrollMax()
}});
if(this.playing){this.currentSound.play()
}this.currentSound.setVolume(this.current_volume)
}}}catch(d){if(!window.location.host.match(/localhost/)){dbg.log(&quot;[UI_Music] Error destroying sound&quot;,d)
}}},updateSize:function(){if(this._firstSound()&amp;&amp;(this._firstSound().api==&quot;sc&quot;||this._firstSound().api==&quot;soundcloud&quot;)){this.initSound()
}else{for(var a in {volume_bar:0,peak_bar:0,seek_bar:0,artist:0,title:0,duration:0}){if(this.cpt.data[a]){$(&quot;.&quot;+a,this.node).show()
}else{$(&quot;.&quot;+a,this.node).hide()
}}$(&quot;.infos&quot;,this.node).width(this.cpt.W()-1-$(&quot;.seek_bar_position&quot;,this.node)[0].offsetLeft-80);
$(&quot;.seek_bar&quot;,this.node).width(this.cpt.W()-1-$(&quot;.seek_bar_position&quot;,this.node)[0].offsetLeft);
this.updateInfosScrollMax()
}},updateInfosScrollMax:function(){var c=0;
var a=this;
if(this.scrollInterval){clearInterval(this.scrollInterval)
}var b=-$(&quot;.infos&quot;,this.node).width()+20;
if(this.cpt.data.artist){b+=$(&quot;.artist&quot;,this.node).width()
}if(this.cpt.data.title){b+=$(&quot;.title&quot;,this.node).width()
}if(b&gt;0){this.scrollInterval=setInterval(function(){c+=1;
$(&quot;.infos&quot;,a.node)[0].scrollLeft=Math.cos(c/40)*b/2+(b/2)
},50)
}},play:function(b){try{if(this.playing){return
}sigCtl.emit(&quot;soundManager.pauseAll&quot;);
this.playing=true;
this.node.find(&quot;.playpause_button&quot;).removeClass(&quot;play_button&quot;).addClass(&quot;pause_button&quot;);
var a=this;
if(b){this.not_working_autostart=setTimeout(function(){if(a.playing){a.pause()
}},30000)
}if(this.currentSound){this.currentSound.play()
}sigCtl.emit(&quot;UI_Music.play&quot;,this)
}catch(c){if(!window.location.host.match(/localhost/)){dbg.log(&quot;[UI_Music] Error play&quot;,c)
}}},pause:function(a){try{if(!this.playing){return
}this.playing=false;
this.node.find(&quot;.playpause_button&quot;).removeClass(&quot;pause_button&quot;).addClass(&quot;play_button&quot;);
if(this.currentSound){if(a){this.currentSound.stop()
}else{this.currentSound.pause()
}}sigCtl.emit(&quot;UI_Music.pause&quot;,this)
}catch(b){if(!window.location.host.match(/localhost/)){dbg.log(&quot;[UI_Music] Error doing pause&quot;,b)
}}},onPropertyChanged:function(a){if(a.include(&quot;sound&quot;)){this._changeProperties();
try{if(this.currentSound){soundManager.destroySound(this.currentSound.sID)
}}catch(b){if(!window.location.host.match(/localhost/)){dbg.log(&quot;[UI_Music] Error destroying sound (onPropertyChanged)&quot;,b)
}}this.initSound()
}else{this.updateSize()
}},onSelect:function(){this._changeProperties()
},_changeProperties:function(){if(this._firstSound()&amp;&amp;(this._firstSound().api==&quot;sc&quot;||this._firstSound().api==&quot;soundcloud&quot;)){$(&quot;.uim_prop_sc&quot;).show();
$(&quot;.uim_prop_sitew&quot;).hide()
}else{$(&quot;.uim_prop_sitew&quot;).show();
$(&quot;.uim_prop_sc&quot;).hide()
}},_firstSound:function(){return $.isArray(this.cpt.data.sound)?this.cpt.data.sound[0]:this.cpt.data.sound
},onHide:function(){if(this.cpt.data.pauseonpagechange){this.pause()
}},onShow:function(){if(this.cpt.data.autostart&amp;&amp;v.mode==&quot;viewer&quot;){this.play(true)
}this.updateSize()
},onRemove:function(){try{if(this.scrollInterval){clearInterval(this.scrollInterval)
}if(this.currentSound){soundManager.destroySound(this.currentSound.sID)
}}catch(a){if(!window.location.host.match(/localhost/)){dbg.log(&quot;[UI_Music] Error destroying sound (onRemove)&quot;,a)
}}},onResizeStop:function(a){this.updateSize()
}};</script><style>.UI_Music .playpause_button{float:left;width:32px;height:32px;margin-right:3px;background:url(/components/UI_Music/player_disabled.png);cursor:pointer}
.UI_Music .pause_button{background:url(/components/UI_Music/player_pause.png)}
.UI_Music .play_button{background:url(/components/UI_Music/player_play.png)}
.UI_Music .volume_bar{position:relative;margin:2px;float:left;width:10px;height:32px;background:url(/components/UI_Music/volume_disabled.png);cursor:pointer}
.UI_Music .current_volume{position:absolute;bottom:0;height:100%;width:10px;background:url(/components/UI_Music/volume.png) bottom}
.UI_Music .volume_bar_setter{position:absolute;bottom:0;height:100%;width:10px;background:0 0}
.UI_Music .peak_bar{position:relative;float:left;width:5px;height:32px;margin:2px;background:0 0}
.UI_Music .peak_value{position:absolute;bottom:0;height:0;width:5px;background:#444}
.UI_Music .seek_bar{position:relative;float:left;top:25px;height:5px;background:#ccc;cursor:pointer}
.UI_Music .loaded_bar{position:absolute;width:0;height:5px;background:#888}
.UI_Music .played_bar{position:absolute;width:0;height:5px;background:#444}
.UI_Music .seek_bar_position{position:relative;float:left;width:0;height:0}
.UI_Music .seek_bar_setter{position:absolute;width:100%;height:5px;background:0 0}
.UI_Music .infos,.UI_Music .duration{position:relative;overflow-x:hidden;float:left;top:0;height:15px;font-size:10px;background:0 0}
.UI_Music .duration{float:right;text-align:right;width:80px}
.UI_Music .infos_scroll{width:500px}
.UI_Music .artist,.UI_Music .title{float:left}
.UI_Music .title{padding-left:10px}</style></uidget>