Commit 6653395c authored by fred's avatar fred

add pause button to inline player

parent 01f375b0
......@@ -130,11 +130,15 @@
playpause.addClass('icon-pause').removeClass('icon-play');
thePlaylist.controlButtons['playpause'].removeClass('icon-play').addClass('icon-pause');
thePlaylist.afterPlay();
}).on('pause',function(){
var sound_id = $(e.target).data('sound-id');
$(document).trigger('panik:play', {'sound_id': sound_id});
}).on('pause',function(e){
$(this).removeClass('playing');
playpause.addClass('icon-play').removeClass('icon-pause');
var sound_id = $(e.target).data('sound-id');
$(document).trigger('panik:pause', {'sound_id': sound_id});
thePlaylist.controlButtons['playpause'].removeClass('icon-pause').addClass('icon-play');
}).on('stop',function(){
}).on('stop',function(event){
$(this).trigger('pause');
if($(this)[0].currentTime){$(this)[0].currentTime = 0;}
}).on("ended", function(e){
......
......@@ -347,11 +347,15 @@ $(function() {
if($(this).attr('data-player-action') == "registerAudio"){
$localList.playlist("registerAudio",audio,doLog(audio.attr('title')+' has been added to your playlist.','ok'));
}else if($(this).attr('data-player-action') == "playAudio"){
$localList.playlist("registerAudio",audio,doLog(audio.attr('title')+' will play soon.','ok'));
$localList.playlist("playSoundId", sound_id);
if ($(this).parent().find('.icon-pause').length) {
$(this).hide();
$(this).parent().find('.icon-pause').show();
if ($(this).hasClass('icon-play-sign')) {
$localList.playlist("registerAudio",audio,doLog(audio.attr('title')+' will play soon.','ok'));
$localList.playlist("playSoundId", sound_id);
if ($(this).parent().find('.icon-pause').length) {
$(this).hide();
$(this).parent().find('.icon-pause').show();
}
} else {
$localList.playlist('pauseSounds');
}
}else if ($(this).attr('data-player-action') == "pauseSounds") {
if ($(this).parent().find('.icon-play-sign').length) {
......@@ -496,7 +500,7 @@ $(function() {
if (matching_audio.length == 0) return;
matching_audio = matching_audio[0];
if (matching_audio.paused || matching_audio.ended) {
/* ignore */
$(this).parents('.sound').find('.icon-play').click();
return;
}
/* try to set time */
......@@ -705,7 +709,20 @@ $(function() {
var konami = new Konami('/party');
$(document).on('panik:play', function(ev, data) {
var $page_audio_controls = $('#Main').find('div.audio[data-sound-id="' + data.sound_id + '"]');
$page_audio_controls.find('.icon-play-sign').removeClass('icon-play-sign').addClass('icon-pause');
});
$(document).on('panik:pause', function(ev, data) {
var $page_audio_controls = $('#Main').find('div.audio[data-sound-id="' + data.sound_id + '"]');
$page_audio_controls.find('.icon-pause').removeClass('icon-pause').addClass('icon-play-sign');
});
$(document).on('panik:timeupdate', function(ev, data) {
var $page_audio_controls = $('#Main').find('div.audio[data-sound-id="' + data.sound_id + '"]');
$page_audio_controls.find('.icon-play-sign').removeClass('icon-play-sign').addClass('icon-pause');
$waveform = $('#Main div.waveform[data-sound-id="' + data.sound_id + '"]');
var elems = $waveform.find('span');
var total_elems = elems.length;
......
{% load soundfiles paniktags %}
{% if sound|is_format_available:'mp3' or sound|is_format_available:'ogg' %}
<div class="audio">
<div class="audio" data-sound-id="{{ sound.id }}">
{% if not embed %}
<button class="resymbol icon-plus-sign big"
title="Add to playlist"
......
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