repo: janusweb action: commit revision: path_from: revision_from: 8f0fc2b9078d755a53441bf5256c6a3f7ce28b3b: path_to: revision_to:
commit 8f0fc2b9078d755a53441bf5256c6a3f7ce28b3b Author: James BaicoianuDate: Mon Apr 19 00:07:37 2021 -0700 object.gain support for videos diff --git a/scripts/object.js b/scripts/object.js
--- a/scripts/object.js
+++ b/scripts/object.js
@@ -48,6 +48,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
roughness: { type: 'float', default: null, min: 0, max: 1, set: this.updateMaterial, comment: 'Material roughness value' },
metalness: { type: 'float', default: null, set: this.updateMaterial, comment: 'Material metalness value' },
usevertexcolors: { type: 'boolean', default: true, set: this.updateMaterial },
+ gain: { type: 'float', default: 1.0, set: this.updateAudioNodes },
onloadstart: { type: 'callback' },
onloadprogress: { type: 'callback' },
onload: { type: 'callback' },
@@ -208,6 +209,8 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
texture.onUpdate = (e) => this.refresh();
this.video = texture.image;
+ this.video.volume = this.gain;
+
elation.events.add(this, 'click', elation.bind(this, this.handleVideoClick));
this.room.videos[videoid] = this;
}
@@ -1224,10 +1227,14 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
}
this.setupOnBeforeRenderListener = function(type, args, arg2, arg3) {
if (this.onbeforerender) {
- console.log('set it up!!!!', this.onbeforerender, type, args, arg2, arg3, this);
this.objects['3d'].onBeforeRender = this.onbeforerender;
}
}
+ this.updateAudioNodes = function() {
+ if (this.video) {
+ this.video.volume = this.gain;
+ }
+ }
this.getProxyObject = function(classdef) {
if (!this._proxyobject) {
this._proxyobject = elation.engine.things.janusobject.extendclass.getProxyObject.call(this, classdef);
-----END OF PAGE-----