I would like to record a firefox browser tab through browser extension like Screencastify extension does in chrome. About Recording Session of chrome extension , chrome.tabCapture API is used to get the stream of the currently active tab and to record the stream RecordRTC.js of Web-RTC Experiment is used. Like wise, Is there any API in Mozilla Firefox to get the stream of the tab in Firefox browser.
P.S : I am asking about recording the tab of the firefox not recording the screen or window or through cam.
You can record a tab in Firefox like this:
Note that for this snippet to work here in the browser, you first have to view this page in https.
And then, for security reasons, you have to append
,stacksnippets.net
to the list of sites inmedia.getusermedia.screensharing.allowed_domains
under about:config to allow this to work.Lastly, you also have to set
media.navigator.permission.disabled
totrue
in about:config since Firefox doesn't implement a Tab chooser.None of this would be necessary in an extension.
In an extension you would use the
browserWindow
constraint to pass in the outer window id of the tab you wish to capture.There are several privileged apis that let you capture parts of windows or xul elements onto a canvas context. The canvas can then be captured into a media stream.