From 9e4e8870fe15b99168e6ecfe2e71b7455ae91c7d Mon Sep 17 00:00:00 2001 From: Brian Peiris <brianpeiris@gmail.com> Date: Mon, 7 May 2018 11:23:39 -0700 Subject: [PATCH] tweaks --- package.json | 2 +- scripts/run-bot.js | 2 +- scripts/run-bot.sh | 11 +++++++---- src/hub.html | 1 + src/hub.js | 1 - src/utils/ios-audio-context-fix.js | 4 +++- yarn.lock | 6 +++--- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 527b304c5..bc24c9577 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "lodash": "^4.17.5", "node-sass": "^4.7.2", "prettier": "^1.7.0", - "puppeteer": "1.3.0", + "puppeteer": "1.1.0", "rimraf": "^2.6.2", "sass-loader": "^6.0.7", "selfsigned": "^1.10.2", diff --git a/scripts/run-bot.js b/scripts/run-bot.js index 4aec8fd5b..d0f95d7b3 100644 --- a/scripts/run-bot.js +++ b/scripts/run-bot.js @@ -24,7 +24,7 @@ const querystring = require("query-string"); }); console.log("BPDEBUG navigated"); // Interact with the page so that audio can play. - page.mouse.click(100, 100); + await page.mouse.click(100, 100); await page.evaluate(() => { window.interacted(); }); diff --git a/scripts/run-bot.sh b/scripts/run-bot.sh index 48fcb470b..71e21d26d 100755 --- a/scripts/run-bot.sh +++ b/scripts/run-bot.sh @@ -4,8 +4,11 @@ script_directory=$(dirname "$0") script_directory=$(realpath "$script_directory") cd $script_directory/.. -yarn build -yarn serve --ssl --port 8080 public -# yarn -# yarn start & +yarn + +# yarn build +# yarn serve --ssl --port 8080 public & + +yarn start & + node scripts/run-bot.js diff --git a/src/hub.html b/src/hub.html index 942459c11..1d973e190 100644 --- a/src/hub.html +++ b/src/hub.html @@ -17,6 +17,7 @@ <% } else { %> <script src="https://cdn.rawgit.com/brianpeiris/aframe/845825ae694449524c185c44a314d361eead4680/dist/aframe-master.js"></script> <% } %> + <script>window.logs.enable("naf-janus-adapter:*")</script> </head> <body data-html-prefix="<%= HTML_PREFIX %>"> diff --git a/src/hub.js b/src/hub.js index 46e85c04c..9d809ddc4 100644 --- a/src/hub.js +++ b/src/hub.js @@ -306,7 +306,6 @@ const onReady = async () => { await interacted; console.log("BPDEBUG playing audio"); audio.play().catch(e => console.log(e.toString())); - NAF.connection.adapter.setLocalMediaStream(mediaStream); } if (mediaStream) { diff --git a/src/utils/ios-audio-context-fix.js b/src/utils/ios-audio-context-fix.js index ce474194f..4707a9877 100644 --- a/src/utils/ios-audio-context-fix.js +++ b/src/utils/ios-audio-context-fix.js @@ -4,7 +4,7 @@ */ const iDevices = /\biPhone.*Mobile|\biPod|\biPad|AppleCoreMedia/; -if (iDevices.test(navigator.userAgent)) { +if (iDevices.test(navigator.userAgent) || /Chrome/.test(navigator.userAgent)) { document.addEventListener("DOMContentLoaded", () => { const ctx = THREE.AudioContext.getContext(); @@ -14,10 +14,12 @@ if (iDevices.test(navigator.userAgent)) { setTimeout(function() { if (ctx.state === "running") { document.body.removeEventListener("touchend", resume, false); + document.body.removeEventListener("mouseup", resume, false); } }, 0); } document.body.addEventListener("touchend", resume, false); + document.body.addEventListener("mouseup", resume, false); }); } diff --git a/yarn.lock b/yarn.lock index da047023a..4370d655c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6756,9 +6756,9 @@ punycode@^1.2.4, punycode@^1.3.2, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" -puppeteer@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.3.0.tgz#f571c5f27153ca164a8188e6328ce2e4946878f3" +puppeteer@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.1.0.tgz#97fbc2fbbf9ab659e7e202a68ac1ba54b8bc0a25" dependencies: debug "^2.6.8" extract-zip "^1.6.5" -- GitLab