diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index c679e3cae44ec38e01a2e1a024630cedf8c36351..b89aefa995a0206f74b14fa2fcafc2e763b96e11 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -14,9 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// this is needed to tell TS about globalThis.Olm -import "@matrix-org/olm"; - export {}; declare global { @@ -34,39 +31,18 @@ declare global { } } - interface MediaDevices { - // This is experimental and types don't know about it yet - // https://github.com/microsoft/TypeScript/issues/33232 - getDisplayMedia(constraints: MediaStreamConstraints | DesktopCapturerConstraints): Promise<MediaStream>; - getUserMedia(constraints: MediaStreamConstraints | DesktopCapturerConstraints): Promise<MediaStream>; - } - - interface DesktopCapturerConstraints { - audio: - | boolean - | { - mandatory: { - chromeMediaSource: string; - chromeMediaSourceId: string; - }; - }; - video: - | boolean - | { - mandatory: { - chromeMediaSource: string; - chromeMediaSourceId: string; - }; - }; + // Chrome-specific getUserMedia constraints + interface MediaTrackConstraints { + mandatory?: { + chromeMediaSource: string; + chromeMediaSourceId: string; + }; } - // eslint-disable-next-line @typescript-eslint/no-empty-object-type - interface DummyInterfaceWeShouldntBeUsingThis {} - interface Navigator { // We check for the webkit-prefixed getUserMedia to detect if we're // on webkit: we should check if we still need to do this - webkitGetUserMedia?: DummyInterfaceWeShouldntBeUsingThis; + webkitGetUserMedia?: unknown; } export interface Uint8ArrayToBase64Options { diff --git a/src/webrtc/mediaHandler.ts b/src/webrtc/mediaHandler.ts index ea70f7f64e926077d2c607eaa4b28025c66383bf..dfdde3f6b06b65d7771f3cb9368f78d94b718239 100644 --- a/src/webrtc/mediaHandler.ts +++ b/src/webrtc/mediaHandler.ts @@ -462,7 +462,7 @@ export class MediaHandler extends TypedEventEmitter< }; } - private getScreenshareContraints(opts: IScreensharingOpts): DesktopCapturerConstraints { + private getScreenshareContraints(opts: IScreensharingOpts): MediaStreamConstraints { const { desktopCapturerSourceId, audio } = opts; if (desktopCapturerSourceId) { return {