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

Révise la gestion des sons via une CollectionView

This commit is contained in:
Antoine
2016-04-10 23:43:09 +02:00
parent a25e921055
commit 36935c6c80
6 changed files with 57 additions and 38 deletions

View File

@@ -11,18 +11,24 @@ define(
defaults: {
title: "",
character: "",
file: ""
file: "",
playing: false
},
play: function() {
this.audio = new Audio('sounds/'+this.attributes.file);
this.audio.play();
if( !this.audio ) {
this.audio = new Audio('sounds/'+this.attributes.file);
}
return this;
this.audio.play();
this.attributes.playing = true;
},
stop: function() {
if( this.audio && !this.audio.paused ) {
this.audio.pause();
this.audio.load();
}
this.attributes.playing = false;
}
});