I am developing a chrome extension and I use chrome.tabCapture API to capture the stream from a tab of the chrome browser and to record the stream using MediaStreamRecorder.js. I could stop the recording of the stream using mediaRecorder.stop() but that chrome.tabCapture API doesn't end. It continously sends the stream. I need to stop the chrome.tabCapture API running for the particular tab.
Try :
stream.getVideoTracks()[0].stop();
To improve video quality, specify videoConstraints :
chrome.tabCapture.capture({
videoConstraints: { mandatory: { maxWidth: 4000,
maxHeight: 4000}
}}, callbackFunction);
来源:https://stackoverflow.com/questions/34715357/how-to-stop-the-capturing-mediastream-that-is-started-by-chrome-tabcapture-api-i