onAdd: function(){},
onPlay: function(){},
onUpdate: function(){},
+ onEnded: function(){},
},
_create: function() {
// Initialization logic here
}
thePlaylist.setFocus(container);
container.addClass('playing');
- playpause.addClass('icon-pause').removeClass('icon-play');
- thePlaylist.controlButtons['playpause'].removeClass('icon-play').addClass('icon-pause');
+ playpause.addClass('action-pause').removeClass('action-play');
+ thePlaylist.controlButtons['playpause'].removeClass('action-play').addClass('action-pause');
thePlaylist.afterPlay();
var sound_id = $(e.target).data('sound-id');
$(document).trigger('panik:play', {'sound_id': sound_id});
if (typeof (_paq) == 'object') {
_paq.push(['trackEvent', 'Audio', 'End', audio_str]);
}
- thePlaylist.playNext();
+ thePlaylist.ended();
}).on('beforePause',function(){
return this;
}).on('beforePlay',function(){
});
var controls = $('<span>',{'class':'soundControls controls'});
var link = $('<a>',{href:sound.url,'class':'button icon-external-link'});
- var remove = $('<button>',{title:"Remove from list",'class':'icon-remove',click:function(){
+ var remove = $('<button>',{title:"Remove from list",'class':'no-icon-remove',click:function(){
container.remove();
thePlaylist._update();
}});
var stop = $('<button>',{title:"Stop",'class':'icon-stop',click:function(){
audio.trigger('stop');
}}).hide();
- var playpause = $('<button>',{title:"Play/Pause",'class':'icon-play',click:function(){
+ var playpause = $('<button>',{title:"Play/Pause",'class':'action-play',click:function(){
if (audio[0].paused == false) { audio.trigger('pause');
} else {
thePlaylist._update();
}});
*/
- this.registerControl('previous',{'class':"icon-step-backward",click:function(){
- thePlaylist.playPrevious();
- }});
- this.registerControl('stop',{'class':"icon-stop",click: function(){
- thePlaylist.stopSounds();
- }});
- this.registerControl('playpause',{'class':"icon-play playPause",click: function(){
+ this.registerControl('playpause',{'class':"action-play playPause",click: function(){
thePlaylist.playPauseList();
}});
- this.registerControl('next',{'class':"icon-step-forward",click: function(){
- thePlaylist.playNext();
- }});
return true;
},
// Play next sound
afterPlay: function() {
+ console.log('after play');
this.options.onPlay(this);
},
// Play next sound
beforePlay: function() {
+ console.log('before play');
this.stopSounds();
},
// Play next sound
},
// Play next sound
playPauseList: function() {
- if(this.controlButtons['playpause'].hasClass('icon-play')){
+ if(this.controlButtons['playpause'].hasClass('action-play')){
this.getActive().find('audio').trigger('beforePlay').trigger('play');
}else{
this.getActive().find('audio').trigger('pause');
pauseSounds: function() {
this.playlistContainer.find('audio').each(function(){$(this).trigger('pause');});
},
+ ended: function() {
+ this.options.onEnded(this);
+ },
// stop all sounds.
stopSounds: function() {
this.playlistContainer.find('audio').each(function(){$(this).trigger('stop');});
},
+ reset: function() {
+ this.isActive = false;
+ this.stopSounds();
+ this.playlistContainer.find('*').remove();
+ this._update();
+ }
});
})(jQuery);