Skip to content

Commit 50e108f

Browse files
committed
Handle PR feedback, ranem image-plus, remove superfluous cannon update
1 parent d6e6163 commit 50e108f

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

src/components/image-plus.js renamed to src/components/media-views.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ class TextureCache {
183183
retain(src) {
184184
const cacheItem = this.cache.get(src);
185185
cacheItem.count++;
186-
console.log("retain", src, cacheItem.count);
186+
// console.log("retain", src, cacheItem.count);
187187
return cacheItem.texture;
188188
}
189189

190190
release(src) {
191191
const cacheItem = this.cache.get(src);
192192
cacheItem.count--;
193-
console.log("release", src, cacheItem.count);
193+
// console.log("release", src, cacheItem.count);
194194
if (cacheItem.count <= 0) {
195195
// Unload the video element to prevent it from continuing to play in the background
196196
if (cacheItem.texture.image instanceof HTMLVideoElement) {
@@ -270,7 +270,6 @@ AFRAME.registerComponent("media-video", {
270270
} else {
271271
texture = await createVideoTexture(src);
272272
texture.audioSource = this.el.sceneEl.audioListener.context.createMediaElementSource(texture.image);
273-
// window.v = texture.image;
274273
this.video = texture.image;
275274

276275
this.video.addEventListener("pause", this.onPauseStateChange);
@@ -307,19 +306,12 @@ AFRAME.registerComponent("media-video", {
307306

308307
this.updatePlaybackState(true);
309308

310-
// TODO: verify if we actually need to do this
311-
if (this.el.components.body && this.el.components.body.body) {
312-
this.el.components.body.syncToPhysics();
313-
this.el.components.body.updateCannonScale();
314-
}
315-
316309
this.el.emit("video-loaded");
317310
},
318311

319312
updatePlaybackState(force) {
320313
if (force || (this.networkedEl && !NAF.utils.isMine(this.networkedEl) && this.video)) {
321314
if (Math.abs(this.data.time - this.video.currentTime) > this.data.syncTolerance) {
322-
// console.log("updating time", this.data.time);
323315
this.video.currentTime = this.data.time;
324316
}
325317
this.data.videoPaused ? this.video.pause() : this.video.play();
@@ -349,7 +341,6 @@ AFRAME.registerComponent("media-video", {
349341

350342
const now = performance.now();
351343
if (now - this.lastUpdate > this.data.tickRate) {
352-
// console.log("sending time", this.video.currentTime);
353344
this.el.setAttribute("media-video", "time", this.video.currentTime);
354345
this.lastUpdate = now;
355346
}
@@ -418,12 +409,6 @@ AFRAME.registerComponent("media-image", {
418409

419410
fitToTexture(this.el, texture);
420411

421-
// TODO: verify if we actually need to do this
422-
if (this.el.components.body && this.el.components.body.body) {
423-
this.el.components.body.syncToPhysics();
424-
this.el.components.body.updateCannonScale();
425-
}
426-
427412
this.el.emit("image-loaded");
428413
}
429414
});

src/hub.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import "./components/networked-avatar";
6363
import "./components/css-class";
6464
import "./components/scene-shadow";
6565
import "./components/avatar-replay";
66-
import "./components/image-plus";
66+
import "./components/media-views";
6767
import "./components/pinch-to-move";
6868
import "./components/look-on-mobile";
6969
import "./components/pitch-yaw-rotator";

0 commit comments

Comments
 (0)