Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow skipping code paths relying upon webRTC #1111

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ import qsTruthy from "./utils/qs_truthy";
const isBotMode = qsTruthy("bot");
const isTelemetryDisabled = qsTruthy("disable_telemetry");
const isDebug = qsTruthy("debug");
const skipWebRTC = qsTruthy("skip_webrtc"); // Used for testing Hubs in non-WebRTC compliant browsers
const loadingEnvironmentURL =
"https://hubs-proxy.com/https://uploads-prod.reticulum.io/files/61d77151-7a74-40a6-b427-0c5a350c4502.glb";

Expand All @@ -189,7 +190,7 @@ detectConcurrentLoad();
store.init();

function getPlatformUnsupportedReason() {
if (typeof RTCDataChannelEvent === "undefined") return "no_data_channels";
if (!skipWebRTC && typeof RTCDataChannelEvent === "undefined") return "no_data_channels";
return null;
}

Expand Down Expand Up @@ -458,6 +459,11 @@ async function handleHubChannelJoined(entryManager, hubChannel, messageDispatch,
};
})
.catch(connectError => {
if (skipWebRTC) {
scene.emit("didConnectToNetworkedScene");
return;
}

// hacky until we get return codes
const isFull = connectError.error && connectError.error.msg.match(/\bfull\b/i);
console.error(connectError);
Expand Down
4 changes: 4 additions & 0 deletions src/react-components/ui-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ const IN_ROOM_MODAL_ROUTER_PATHS = ["/media"];
const IN_ROOM_MODAL_QUERY_VARS = ["media_source"];

async function grantedMicLabels() {
if (!navigator.mediaDevices) return [];

const mediaDevices = await navigator.mediaDevices.enumerateDevices();
return mediaDevices.filter(d => d.label && d.kind === "audioinput").map(d => d.label);
}
Expand Down Expand Up @@ -663,6 +665,8 @@ class UIRoot extends Component {

fetchMicDevices = () => {
return new Promise(resolve => {
if (!navigator.mediaDevices) return resolve();

navigator.mediaDevices.enumerateDevices().then(mediaDevices => {
this.setState(
{
Expand Down