如何停止chrome中的chrome.tabCapture API启动的捕获媒体流 [英] How to stop the capturing mediastream that is started by chrome.tabCapture API in chrome
问题描述
我正在开发Chrome扩展程序,并使用 chrome.tabCapture API来捕获流Chrome浏览器的选项卡,并使用 MediaStreamRecorder.js 记录流。我可以使用mediaRecorder.stop()停止记录流,但是chrome.tabCapture API不会结束。它不断发送流。我需要停止为特定选项卡运行chrome.tabCapture API。
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.
推荐答案
试试:
stream.getVideoTracks()[0].stop();
要改善视频质量,请指定 videoConstraints
:
To improve video quality, specify videoConstraints
:
chrome.tabCapture.capture({
videoConstraints: { mandatory: { maxWidth: 4000,
maxHeight: 4000}
}}, callbackFunction);
这篇关于如何停止chrome中的chrome.tabCapture API启动的捕获媒体流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!