w3c / mediacapture-screen-share-extensions

Other
1 stars 0 forks source link

Cross-Type Surface Switching #16

Open tovepet opened 1 month ago

tovepet commented 1 month ago

Note: This is a new issue separated out from https://github.com/w3c/mediacapture-screen-share-extensions/issues/4

Some browsers allow users to switch an ongoing screen-capture to instead share another surface. Currently, such surface switching is primarily between surfaces of the same type, and we would like to expand this functionality to also allow surface-switching between different types of surfaces.

However, some applications adapt their behavior to what type of surface they share. In the case of existing applications they typically check the type of the track returned from getDisplayMedia and then expect the type to remain constant throughout the capture. For backward compatibility with such applications, we propose an opt-in to enable cross-type surface switching:

getDisplayMedia({allowCrossTypeSurfaceSwitching: “include”});

Initially, the default value for this option should be “exclude”, but as applications are updated to handle cross-type surface switching, it should be possible to change the default value to “include”, and eventually remove this option. The default value for this option can be left unspecified to let each browser vendor decide.

Note: Reusing the same track-object for cross-type surface-switching is incompatible with using different JavaScript classes for different surface-types. While the Region Capture spec allows browsers to use a subclass of MediaStreamTrack for tab-captures, it does not require it. To minimize the scope of this issue, changes to the Region Capture spec are better left for a follow-up issue.

eladalon1983 commented 1 month ago

nit: Possibly change "allowCrossTypeSurfaceSwitching" to "crossTypeSurfaceSwitching". In my humble opinion, crossTypeSurfaceSwitching: "include" flows better than allow...: "include".

(Note for those who might be new to this - the "include"/"exclude" pattern is pre-existing. Whatever one might think of this pattern, it can't be denied that consistency is nice.)