repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 97bfc2b7ee6b03986f3fbab74f34a4ce7e616d99:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 97bfc2b7ee6b03986f3fbab74f34a4ce7e616d99
Author: James Baicoianu 
Date:   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
index 7bbc3e854efc4290790e6c814b83fc1c18ea772a..
index ..12b934ec3882f14ce5627a60097a32cebdaee1ad 100644
--- 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-----