From 75ee545b7ad95ad56eb2aacb3c5252712c766ad6 Mon Sep 17 00:00:00 2001
From: Greg Fodor <gfodor@gmail.com>
Date: Tue, 30 Oct 2018 17:17:15 +0000
Subject: [PATCH] Mobile fixes

---
 src/react-components/2d-hud.js | 7 ++++---
 src/scene-entry-manager.js     | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/react-components/2d-hud.js b/src/react-components/2d-hud.js
index bda0fe108..009bf7d11 100644
--- a/src/react-components/2d-hud.js
+++ b/src/react-components/2d-hud.js
@@ -44,12 +44,11 @@ class TopHUD extends Component {
 
   buildVideoSharingButtons = () => {
     if (this.props.availableVREntryTypes.isInHMD) return null;
+    const isMobile = AFRAME.utils.device.isMobile();
 
     const videoShareExtraOptionTypes = [];
     const primaryVideoShareType =
-      this.props.videoShareMediaSource ||
-      this.state.lastActiveMediaSource ||
-      (AFRAME.utils.device.isMobile() ? "camera" : "screen");
+      this.props.videoShareMediaSource || this.state.lastActiveMediaSource || (isMobile ? "camera" : "screen");
 
     if (this.state.showVideoShareOptions) {
       videoShareExtraOptionTypes.push(primaryVideoShareType);
@@ -62,6 +61,8 @@ class TopHUD extends Component {
     }
 
     const showExtrasOnHover = () => {
+      if (isMobile) return;
+
       clearTimeout(this.hideVideoSharingButtonTimeout);
 
       if (!this.props.videoShareMediaSource) {
diff --git a/src/scene-entry-manager.js b/src/scene-entry-manager.js
index 6614d9be1..2e11588f2 100644
--- a/src/scene-entry-manager.js
+++ b/src/scene-entry-manager.js
@@ -302,7 +302,7 @@ export default class SceneEntryManager {
       if (isHandlingVideoShare) return;
       isHandlingVideoShare = true;
 
-      if (currentVideoShareEntity.parentNode) {
+      if (currentVideoShareEntity && currentVideoShareEntity.parentNode) {
         currentVideoShareEntity.parentNode.removeChild(currentVideoShareEntity);
       }
 
-- 
GitLab