diff options
Diffstat (limited to 'assets/js/models/sample.js')
| -rw-r--r-- | assets/js/models/sample.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/assets/js/models/sample.js b/assets/js/models/sample.js index 79cbace..5483f01 100644 --- a/assets/js/models/sample.js +++ b/assets/js/models/sample.js @@ -6,11 +6,23 @@ ClipPlay.Models.Sample = Backbone.Model.extend({ 'duration': '', 'key': '', 'player': '', - 'iframe': '' + 'iframe': '', + 'timeout' : '' }, - - + + play: function() { - + console.log('playing'); + //play then pause + window.clearTimeout(this.get('timeout')); + this.get('player').pause(); + this.get('player').seekTo(this.get('start')); + this.get('player').play(); + var that = this; + var length = this.get('stop') - this.get('start'); + console.log(length); + this.set('timeout',setTimeout(function(){ + that.get('player').pause(); + }, length*1000 )); } -});
\ No newline at end of file +}); |
