From 0a1841512314c204e7e54d1a18a63385faecd6b2 Mon Sep 17 00:00:00 2001 From: Kawandeep Virdee Date: Sun, 10 Nov 2013 02:32:24 -0500 Subject: default keys, listener on key change --- assets/js/models/sample.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'assets/js/models/sample.js') diff --git a/assets/js/models/sample.js b/assets/js/models/sample.js index 5483f01..5179a7c 100644 --- a/assets/js/models/sample.js +++ b/assets/js/models/sample.js @@ -1,15 +1,20 @@ ClipPlay.Models.Sample = Backbone.Model.extend({ defaults: { 'url': '', - 'start': '', - 'stop': '', + 'start': '3', + 'stop': '4', 'duration': '', 'key': '', 'player': '', 'iframe': '', 'timeout' : '' }, - + initialize: function() { + var a = ClipPlay.Config['key_defaults'].shift(); + if(a){ + this.set('key', a); + } + }, play: function() { console.log('playing'); @@ -19,7 +24,7 @@ ClipPlay.Models.Sample = Backbone.Model.extend({ this.get('player').seekTo(this.get('start')); this.get('player').play(); var that = this; - var length = this.get('stop') - this.get('start'); + var length = Math.abs(this.get('stop') - this.get('start')); console.log(length); this.set('timeout',setTimeout(function(){ that.get('player').pause(); -- cgit v1.2.3