diff --git a/front/src/WebRtc/ScreenSharingPeer.ts b/front/src/WebRtc/ScreenSharingPeer.ts index 3a87429b..be534276 100644 --- a/front/src/WebRtc/ScreenSharingPeer.ts +++ b/front/src/WebRtc/ScreenSharingPeer.ts @@ -2,7 +2,7 @@ import type * as SimplePeerNamespace from "simple-peer"; import {mediaManager} from "./MediaManager"; import {STUN_SERVER, TURN_PASSWORD, TURN_SERVER, TURN_USER} from "../Enum/EnvironmentVariable"; import type {RoomConnection} from "../Connexion/RoomConnection"; -import {MESSAGE_TYPE_CONSTRAINT} from "./VideoPeer"; +import {MESSAGE_TYPE_CONSTRAINT, PeerStatus} from "./VideoPeer"; import type {UserSimplePeerInterface} from "./SimplePeer"; import {Readable, readable, writable, Writable} from "svelte/store"; import {videoFocusStore} from "../Stores/VideoFocusStore"; @@ -22,7 +22,7 @@ export class ScreenSharingPeer extends Peer { public readonly userId: number; public readonly uniqueId: string; public readonly streamStore: Readable; - public readonly statusStore: Readable<"connecting" | "connected" | "error" | "closed">; + public readonly statusStore: Readable; constructor(user: UserSimplePeerInterface, initiator: boolean, public readonly userName: string, private connection: RoomConnection, stream: MediaStream | null) { super({ @@ -71,7 +71,7 @@ export class ScreenSharingPeer extends Peer { }; }); - this.statusStore = readable<"connecting" | "connected" | "error" | "closed">("connecting", (set) => { + this.statusStore = readable("connecting", (set) => { const onConnect = () => { set('connected'); }; diff --git a/front/src/WebRtc/VideoPeer.ts b/front/src/WebRtc/VideoPeer.ts index 2ff3adef..0840d6ff 100644 --- a/front/src/WebRtc/VideoPeer.ts +++ b/front/src/WebRtc/VideoPeer.ts @@ -12,6 +12,8 @@ import {discussionManager} from "./DiscussionManager"; const Peer: SimplePeerNamespace.SimplePeer = require('simple-peer'); +export type PeerStatus = "connecting" | "connected" | "error" | "closed"; + export const MESSAGE_TYPE_CONSTRAINT = 'constraint'; export const MESSAGE_TYPE_MESSAGE = 'message'; export const MESSAGE_TYPE_BLOCKED = 'blocked'; @@ -29,7 +31,7 @@ export class VideoPeer extends Peer { private onBlockSubscribe: Subscription; private onUnBlockSubscribe: Subscription; public readonly streamStore: Readable; - public readonly statusStore: Readable<"connecting" | "connected" | "error" | "closed">; + public readonly statusStore: Readable; public readonly constraintsStore: Readable; constructor(public user: UserSimplePeerInterface, initiator: boolean, public readonly userName: string, private connection: RoomConnection, localStream: MediaStream | null) { @@ -92,7 +94,7 @@ export class VideoPeer extends Peer { }; }); - this.statusStore = readable<"connecting" | "connected" | "error" | "closed">("connecting", (set) => { + this.statusStore = readable("connecting", (set) => { const onConnect = () => { set('connected'); };