stop screen shareing with navigator.mediaDevices
- User
stop screen shareing with navigator.mediaDevices
- Assistant
To stop screen sharing using the
navigator.mediaDevicesAPI in JavaScript, you should first ensure you have access to theMediaStreamobject that was returned when the screen share was initially started. ThisMediaStreamobject contains one or moreMediaStreamTrackobjects, which represent the video and audio tracks of the stream. To stop the screen sharing, you need to stop these tracks.