repo: janusweb action: commit revision: path_from: revision_from: 97bfc2b7ee6b03986f3fbab74f34a4ce7e616d99: path_to: revision_to:
commit 97bfc2b7ee6b03986f3fbab74f34a4ce7e616d99 Author: James BaicoianuDate: Tue Mar 27 09:38:35 2018 -0700 Fix video aspect ratio and frame updating diff --git a/scripts/video.js b/scripts/video.js
--- a/scripts/video.js
+++ b/scripts/video.js
@@ -22,6 +22,7 @@ elation.require(['janusweb.janusbase'], function() {
elation.events.add(this.texture, 'asset_load', elation.bind(this, this.imageloaded));
elation.events.add(this.video, 'loadeddata', elation.bind(this, this.videoloaded));
elation.events.add(this.video, 'playing', elation.bind(this, this.videoStartedPlaying));
+
return new THREE.Mesh(geo, mat);
} else {
console.log('ERROR - could not find video ' + this.properties.video_id);
@@ -46,7 +47,8 @@ elation.require(['janusweb.janusbase'], function() {
});
}
texture.minFilter = THREE.LinearFilter;
- elation.events.add(texture, 'videoframe', elation.bind(this, this.refresh));
+ // Refresh this object whenever the video has a new frame for us to display
+ this.texture.onUpdate = (e) => this.refresh();
}
this.texture.minFilter = THREE.LinearFilter;
@@ -70,6 +72,7 @@ elation.require(['janusweb.janusbase'], function() {
if (!this.audionodes) {
this.initSound();
}
+ this.adjustAspectRatio();
}
this.initSound = function() {
var listener = this.engine.systems.sound.getRealListener(),
-----END OF PAGE-----