Skip to content

Instantly share code, notes, and snippets.

@jswanner
Last active August 29, 2018 16:43
Show Gist options
  • Save jswanner/f45e3b181a99677b503c48aad7c0b909 to your computer and use it in GitHub Desktop.
Save jswanner/f45e3b181a99677b503c48aad7c0b909 to your computer and use it in GitHub Desktop.
p3sdk-test
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement: function() {
this._super();
this.player = videojs(this.$('video')[0], null, function() {
this.play();
});
},
didRender: function() {
this._super();
p3sdk.api.base_path = "https://static.3playmedia.com/p/projects/";
p3sdk.initialize_container(this.$('.p3sdk-container')[0]);
},
willDestroyElement() {
this._super();
this.player.dispose();
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
hide: function() {
this.toggleProperty('isShowing');
},
show: function() {
this.incrementProperty('videoId');
this.toggleProperty('isShowing');
}
},
isShowing: false,
videoId: 0
});
<link href="//vjs.zencdn.net/7.1.0/video-js.css" rel="stylesheet">
<style>
.p3sdk-current-word {
background: #999;
color: #fff;
}
</style>
{{#if isShowing}}
<button {{action "hide"}}>Hide</button>
{{video-js videoId=(concat "video-" videoId)}}
{{else}}
<button {{action "show"}}>Show</button>
{{/if}}
{{outlet}}
<div class="p3sdk-container" player_id="{{videoId}}" player_type="videojs">
<video id="{{videoId}}">
<source src="https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4" type="video/mp4"/>
<source src="https://www.quirksmode.org/html5/videos/big_buck_bunny.webm" type="video/webm"/>
<source src="https://www.quirksmode.org/html5/videos/big_buck_bunny.ogv" type="video/ogg"/>
</video>
<div class="p3sdk-interactive-transcript" file_id="915165" light_scroll="true" project_id="16929">
<div class="p3sdk-interactive-transcript-content"></div>
</div>
</div>
{{yield}}
import { run } from '@ember/runloop';
export default function destroyApp(application) {
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';
import { start } from 'ember-cli-qunit';
setResolver(resolver);
start();
{
"version": "0.15.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.2.2",
"ember-template-compiler": "3.2.2",
"ember-testing": "3.2.2",
"p3sdk": "https://p3.3playmedia.com/p3sdk.current.js",
"video.js": "//vjs.zencdn.net/7.1.0/video.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment