Typescript: dom.lib.ts: MediaDevices.getDisplayMedia is in the wrong place

Created on 8 Jun 2019  路  11Comments  路  Source: microsoft/TypeScript

TypeScript Version: 3.5.1

https://w3c.github.io/mediacapture-screen-share/#mediadevices-additions

in dom.lib.ts navigator.mediaDevices.getDisplayMedia is not found. it looks like it's defined on navigator whereas it should be in the MediaDevices type.

https://github.com/microsoft/TypeScript/blob/87058448797597e6e8bd13ff3d8823fff5607df6/lib/lib.dom.d.ts#L10579-L10583

Bug

Most helpful comment

I finally fix the issue by using Javascript instead of typescript

All 11 comments

Broken since 2.9 (or maybe 2.8, hard to tell where the cutoff is). 79e5e79ef77

I'm not sure where this is coming from actually. It's not anywhere in src/lib and a recursive grep of the typescript repo only turns up the one hit for getDisplayMedia (outside tests). I need to look at the code that generates the LKG I guess.

This goes away entirely in https://github.com/microsoft/TypeScript/pull/32578. That explains why I can't find any mention of it in the source.

Closing for now. We can investigate re-adding it under MediaDevices, based on the w3c spec.

Hi @sandersn this is a huge issue for us, can you please tell us what is the status of it or a workaround we can use ?? We don't find the getDisplayMedia anywhere

It's been a while since I looked at this, so this is a bit of a guess:

  1. getDisplayMedia was in the wrong place.
  2. In July (which was TS 3.7 I think?), getDisplayMedia got deleted entirely.
  3. The next step for a fix is to add MediaDevices to microsoft/TSJS-lib-generator, based on the w3c spec ideally.

How about not closing issues until they, you know, actually get fixed? Then, maybe, they won鈥檛 get dropped on the floor like this?

@Spongman you are looking for #33232 I think. This issue tracked getDisplayMedia being in the wrong place.

surely that's a duplicate of this issue?

I finally fix the issue by using Javascript instead of typescript

in vue add interfaces in shims-tsx.d.ts
`import Vue, { VNode } from 'vue'

declare global {
namespace JSX {
// tslint:disable no-empty-interface
interface Element extends VNode { }
// tslint:disable no-empty-interface
interface ElementClass extends Vue { }
interface IntrinsicElements {
[elem: string]: any;
}
}
interface MediaDevices {
getDisplayMedia(constraints?: MediaStreamConstraints): Promise;
}

interface MediaTrackConstraintSet {
cursor?: string;
}
}`
this is a temporary solution

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Antony-Jones picture Antony-Jones  路  3Comments

Zlatkovsky picture Zlatkovsky  路  3Comments

wmaurer picture wmaurer  路  3Comments

dlaberge picture dlaberge  路  3Comments

CyrusNajmabadi picture CyrusNajmabadi  路  3Comments