Commit 6b2da2d4 authored by Simon Daron's avatar Simon Daron
Browse files

Pause playlist on stream et viceversa

parent d1b6f52f
......@@ -19,6 +19,7 @@
itemClasses: "",
playlistContainer: $('<ol>'),
onAdd: function(){},
onPlay: function(){},
},
_create: function() {
// Initialization logic here
......@@ -90,6 +91,7 @@
playpause.addClass('icon-pause').removeClass('icon-play');
thePlaylist.playlistContainer.find('audio:not(.playing)').trigger('stop');
thePlaylist.playpause.removeClass('icon-play').addClass('icon-pause');
thePlaylist.afterPlay();
}).on('pause',function(){
$(this).removeClass('playing');
playpause.addClass('icon-play').removeClass('icon-pause');
......@@ -133,11 +135,11 @@
return container;
},
// Create a public method.
registerAudio: function(audio,success=function(){}) {
registerAudio: function(audio,success) {
var htmlAudio = this._htmlifyJsonSound(this.jsonifyAudio(audio));
this.playlistContainer.append(htmlAudio);
this.options.onAdd();
success();
if(success){success();}
this._update();
},
// Build controls
......@@ -163,6 +165,10 @@
return true;
},
// Play next sound
afterPlay: function() {
this.options.onPlay();
},
// Play next sound
beforePlay: function() {
this.stopSounds();
},
......
......@@ -9,7 +9,8 @@ $(function() {
var $main = $("#Changing");
var $log = $("#userLog");
var $localList = $('#localList').playlist({
playlistContainer: $('<ol>',{class:"custom"}).sortable()
playlistContainer: $('<ol>',{class:"custom"}).sortable(),
onPlay:function(){$('#DirectStreamPanik')[0].pause();}
});
String.prototype.decodeHTML = function() {
return $("<div>", {html: "" + this}).html();
......
......@@ -6,7 +6,7 @@
<li><button class="icon-eye-open " title="Show/Hidden HTML5 audio player" onclick="$('#DirectStreamPanik').toggleClass('hidden');$(this).toggleClass('icon-eye-open icon-eye-close');return false;"></button></li>
<li><button title="Need some help?" onclick="$('#PlayerHelp').toggle();" class="icon-question-sign"></button></li>
</ul>
<button data-audio-id="DirectStreamPanik" >
<button id="DirectStreamPanikControler">
<span class="control icon-volume-up resymbol huge"></span>
<span class="label">&nbsp;en direct</span>
</button>
......@@ -72,15 +72,23 @@
}else{$(this).trigger('deactivate');}
return false;
});
$("[data-audio-id]").click(function(e) {
$("#DirectStreamPanikControler").on('click',function(e) {
e.preventDefault();
var song = $('#'+$(this).attr('data-audio-id')).get(0);
if (song.paused){
song.play();$('#RefreshWhatsOnAir').trigger('activate');
var stream = $('#DirectStreamPanik').get(0);
if (stream.paused == false){
stream.pause();
}else{
song.pause();$('#RefreshWhatsOnAir').trigger('deactivate');
stream.play();
}
$(this).children('.icon-volume-up,.icon-pause').toggleClass('icon-volume-up').toggleClass('icon-pause');
});
$('#DirectStreamPanik').on('play',function(){alert('play');
$('audio:not(#DirectStreamPanik)').each(function(){this.pause();});
$('#DirectStreamPanikControler').find('.control').removeClass('icon-volume-up').addClass('icon-pause');
$('#RefreshWhatsOnAir').trigger('activate');
}).on('pause',function(){
//$('audio:not(#DirectStreamPanik)').each(function(){this.pause();});
$('#DirectStreamPanikControler').find('.control').addClass('icon-volume-up').removeClass('icon-pause');
$('#RefreshWhatsOnAir').trigger('deactivate');
});
});
</script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment