1
0
mirror of https://github.com/2ec0b4/kaamelott-soundboard.git synced 2025-12-08 15:43:24 +00:00

Stoppe la lecture en cours

This commit is contained in:
Antoine
2016-04-10 14:17:50 +02:00
parent 342ba56bf4
commit 190d2c6420
2 changed files with 12 additions and 3 deletions

View File

@@ -15,7 +15,9 @@ define(
play: function() {
var audio = new Audio('sounds/'+this.attributes.file);
return audio.play();
audio.play();
return audio;
}
});

View File

@@ -11,7 +11,7 @@ define(
"use strict";
var SoundListView = Marionette.LayoutView.extend({
collection : new SoundsCollection(),
collection: new SoundsCollection(),
template: SoundListTemplate,
ui: {
soundItem: 'li a'
@@ -39,8 +39,15 @@ define(
e.preventDefault();
this.stopCurrentPlay();
if( sound ) {
sound.play();
this.currentPlay = sound.play();
}
},
stopCurrentPlay: function() {
if( this.currentPlay && !this.currentPlay.paused ) {
this.currentPlay.pause();
}
},
serializeData: function () {