summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/js/app.js3
-rw-r--r--assets/js/models/sample.js22
-rw-r--r--assets/js/views/sample.js12
3 files changed, 30 insertions, 7 deletions
diff --git a/assets/js/app.js b/assets/js/app.js
index e480cda..cee86e0 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -10,6 +10,9 @@ ClipPlay.App.addInitializer(function(options) {
});
sample_editor_view.render();
$('#samples').append(sample_editor_view.$el);
+
+ //just to have something loaded for debugging
+ samples_collection.add({url:"https://vimeo.com/18150336"});
});
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
+});
diff --git a/assets/js/views/sample.js b/assets/js/views/sample.js
index 5159350..ec7d4a0 100644
--- a/assets/js/views/sample.js
+++ b/assets/js/views/sample.js
@@ -1,5 +1,8 @@
ClipPlay.Views.Sample = Marionette.ItemView.extend({
template: '#sample-view-template',
+ events: {
+ 'blur .js-keyboard-key': 'on_keyboard_bind'
+ },
onRender: function() {
this.initialize_player();
@@ -21,10 +24,10 @@ ClipPlay.Views.Sample = Marionette.ItemView.extend({
});
$('#video').append(iframe[0]);
var player = new OP.Player(iframe[0]);
- window.BOKASHAKA = that;
that.model.set('player', player);
that.model.set('iframe', iframe);
+ window.BOKASHAKA = that.model;
player.getDuration(function(value) {
that.model.set('duration', value);
});
@@ -43,5 +46,10 @@ ClipPlay.Views.Sample = Marionette.ItemView.extend({
el: this.$('.js-end-position'),
model: this.model
});
- }
+ },
+
+ on_keyboard_bind: function(){
+ var keyval = this.$('.js-keyboard-key').val();
+ this.model.set('key',keyval );
+ }
});