From 87fa3462ea72a88fcd1216ea44df2699b2bd30cc Mon Sep 17 00:00:00 2001 From: Rezmason Date: Sun, 19 Dec 2021 12:33:29 -0800 Subject: [PATCH] Add error handling if the holoplay service cannot be reached. --- js/regl/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/regl/main.js b/js/regl/main.js index 21479ca..1f8f1af 100644 --- a/js/regl/main.js +++ b/js/regl/main.js @@ -51,6 +51,7 @@ export default async (canvas, config) => { optionalExtensions: ["EXT_color_buffer_half_float", "WEBGL_color_buffer_float", "OES_standard_derivatives"], }); + const noDeviceLKG = { tileX: 1, tileY: 1, fov: 90 }; const lkg = await new Promise((resolve, reject) => { const client = new HoloPlayCore.Client((data) => { /* @@ -99,7 +100,7 @@ export default async (canvas, config) => { if (data.devices.length === 0) { - resolve({ tileX: 1, tileY: 1, fov: 90 }); + resolve(noDeviceLKG); return; } @@ -138,7 +139,10 @@ export default async (canvas, config) => { }; resolve(output); - }, reject); + }, (error) => { + console.warn("Holoplay connection error:", error); + resolve(noDeviceLKG); + }); }); // All this takes place in a full screen quad.