summaryrefslogtreecommitdiffstats
path: root/assets/js/models/sample.js
blob: 5483f015e5dbdacee12aa75cce3bb14aab128c86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
ClipPlay.Models.Sample = Backbone.Model.extend({
	defaults: {
		'url': '',
		'start': '',
		'stop': '',
		'duration': '',
		'key': '',
		'player': '',
		'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 ));
	}
});