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

Révise des noms d'attributs pour la gestion de la lecture

This commit is contained in:
Antoine
2016-04-10 22:17:53 +02:00
parent 6ede6e4cbf
commit a25e921055
2 changed files with 14 additions and 9 deletions

View File

@@ -7,17 +7,22 @@ define(
"use strict";
var Sound = Backbone.Model.extend({
audio: null,
defaults: {
title: "",
character: "",
file: ""
},
play: function() {
var audio = new Audio('sounds/'+this.attributes.file);
this.audio = new Audio('sounds/'+this.attributes.file);
this.audio.play();
audio.play();
return audio;
return this;
},
stop: function() {
if( this.audio && !this.audio.paused ) {
this.audio.pause();
}
}
});