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 d059f6b..7cb417f 100644 --- a/assets/js/models/sample.js +++ b/assets/js/models/sample.js @@ -6,10 +6,11 @@ ClipPlay.Models.Sample = Backbone.Model.extend({  		'duration': '',  		'key': '',  		'player': '', -		'iframe': '' +		'iframe': '', +        'timeout' : ''  	}, -	 -	 + +  	in_minutes_and_seconds: function(seconds) {  		var minutes = Math.floor(seconds / 60);  		seconds = Math.floor(seconds); @@ -35,6 +36,17 @@ ClipPlay.Models.Sample = Backbone.Model.extend({  	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 +}); | 
