latest dev
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
export class MediaStreamConstraintsError extends Error {
|
||||
static NAME = "MediaStreamConstraintsError";
|
||||
|
||||
constructor() {
|
||||
super(
|
||||
"Unable to access your camera or microphone. Your browser is too old. Please consider upgrading your browser or try using a recent version of Chrome."
|
||||
);
|
||||
this.name = MediaStreamConstraintsError.NAME;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
export const loginSceneVisibleStore = writable(false);
|
||||
export const loginSceneVisibleIframeStore = writable(false);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { WebviewOnOldIOS } from "./Errors/WebviewOnOldIOS";
|
||||
import { gameOverlayVisibilityStore } from "./GameOverlayStoreVisibility";
|
||||
import { peerStore } from "./PeerStore";
|
||||
import { privacyShutdownStore } from "./PrivacyShutdownStore";
|
||||
import { MediaStreamConstraintsError } from "./Errors/MediaStreamConstraintsError";
|
||||
|
||||
/**
|
||||
* A store that contains the camera state requested by the user (on or off).
|
||||
@@ -255,6 +256,12 @@ export const mediaStreamConstraintsStore = derived(
|
||||
video: currentVideoConstraint,
|
||||
audio: currentAudioConstraint,
|
||||
});
|
||||
localUserStore.setCameraSetup(
|
||||
JSON.stringify({
|
||||
video: currentVideoConstraint,
|
||||
audio: currentAudioConstraint,
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -413,7 +420,7 @@ export const localStreamStore = derived<Readable<MediaStreamConstraints>, LocalS
|
||||
});
|
||||
return;
|
||||
} catch (e) {
|
||||
if (constraints.video !== false) {
|
||||
if (constraints.video !== false || constraints.audio !== false) {
|
||||
console.info(
|
||||
"Error. Unable to get microphone and/or camera access. Trying audio only.",
|
||||
$mediaStreamConstraintsStore,
|
||||
@@ -425,7 +432,17 @@ export const localStreamStore = derived<Readable<MediaStreamConstraints>, LocalS
|
||||
error: e,
|
||||
});
|
||||
// Let's try without video constraints
|
||||
requestedCameraState.disableWebcam();
|
||||
if (constraints.video !== false) {
|
||||
requestedCameraState.disableWebcam();
|
||||
}
|
||||
if (constraints.audio !== false) {
|
||||
requestedMicrophoneState.disableMicrophone();
|
||||
}
|
||||
} else if (!constraints.video && !constraints.audio) {
|
||||
set({
|
||||
type: "error",
|
||||
error: new MediaStreamConstraintsError(),
|
||||
});
|
||||
} else {
|
||||
console.info(
|
||||
"Error. Unable to get microphone and/or camera access.",
|
||||
@@ -561,3 +578,8 @@ localStreamStore.subscribe((streamResult) => {
|
||||
* A store containing the real active media is mobile
|
||||
*/
|
||||
export const obtainedMediaConstraintIsMobileStore = writable(false);
|
||||
|
||||
/**
|
||||
* A store containing if user is silent, so if he is in silent zone. This permit to show et hide camera of user
|
||||
*/
|
||||
export const isSilentStore = writable(false);
|
||||
|
||||
@@ -6,6 +6,8 @@ import { CONTACT_URL } from "../Enum/EnvironmentVariable";
|
||||
export const menuIconVisiblilityStore = writable(false);
|
||||
export const menuVisiblilityStore = writable(false);
|
||||
export const menuInputFocusStore = writable(false);
|
||||
export const loginUrlStore = writable(false);
|
||||
export const userIsConnected = writable(false);
|
||||
|
||||
let warningContainerTimeout: Timeout | null = null;
|
||||
function createWarningContainerStore() {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { writable } from "svelte/store";
|
||||
import type { PlayerInterface } from "../Phaser/Game/PlayerInterface";
|
||||
import type { RoomConnection } from "../Connexion/RoomConnection";
|
||||
import { getRandomColor } from "../WebRtc/ColorGenerator";
|
||||
import { localUserStore } from "../Connexion/LocalUserStore";
|
||||
|
||||
let idCount = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user