Skip to content

Instantly share code, notes, and snippets.

@pat123456
Last active January 31, 2017 23:09
Show Gist options
  • Save pat123456/97830ad58b88dc56ff969c45a24957eb to your computer and use it in GitHub Desktop.
Save pat123456/97830ad58b88dc56ff969c45a24957eb to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
extracts: {'one_big_rabbit':[7,11], 'three_rodents':[12,14.5]},
interv: null,
extractToPlayChanged: Ember.observer('extractToPlay', function() {
let extractToPlay = this.get('extractToPlay');
let video = this.$("video")[0];
let from = this.get('extracts')[extractToPlay][0];
let to = this.get('extracts')[extractToPlay][1];
clearInterval(this.get('interv'));
video.currentTime = from;
video.play();
let _this=this;
this.set('interv', setInterval(function(){
if(video.currentTime > to){
video.pause();
clearInterval(_this.get('interv'));
}
},100))
}),
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Player vidéo test',
extractToPlay: null,
actions: {
playExtract(pExtract) {
this.set('extractToPlay', pExtract);
}
},
});
<h1>{{appName}}</h1>
{{#video-player extractToPlay=extractToPlay}}{{/video-player}}
<button {{action 'playExtract' 'one_big_rabbit'}} >One big rabbit</button><br />
<button {{action 'playExtract' 'three_rodents'}} >Three rodents</button>
<br>
<br>
<video src="http://download.blender.org/peach/trailer/trailer_400p.ogg" width="400" ></video>
import Ember from 'ember';
export default function destroyApp(application) {
Ember.run(application, 'destroy');
}
import Resolver from '../../resolver';
import config from '../../config/environment';
const resolver = Resolver.create();
resolver.namespace = {
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix
};
export default resolver;
import Ember from 'ember';
import Application from '../../app';
import config from '../../config/environment';
const { run } = Ember;
const assign = Ember.assign || Ember.merge;
export default function startApp(attrs) {
let application;
let attributes = assign({rootElement: "#test-root"}, config.APP);
attributes = assign(attributes, attrs); // use defaults, but you can override;
run(() => {
application = Application.create(attributes);
application.setupForTesting();
application.injectTestHelpers();
});
return application;
}
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
setResolver(resolver);
{
"version": "0.11.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.10.2",
"ember-data": "2.11.0",
"ember-template-compiler": "2.10.2",
"ember-testing": "2.10.2"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment