(mostly lifted from https://github.com/BrowserWorks/Waterfox/issues/1895, since the Waterfox developers refused to implement this with no real explanation. 5th most 👍'd issue by the way)
DESCRIBE THE BUG
It is not possible to capture / record a restricted video because it is disabled in the official Firefox source code (captureStream API is disabled for DRM with Widevine / EME). The restriction / censorship source code seems to be currently located at line 4075 in the function HTMLMediaElement::CanBeCaptured of the file https://searchfox.org/firefox-main/source/dom/media/mediaelement/HTMLMediaElement.cpp#4075:
// Prevent capturing restricted video
if (aCaptureType == StreamCaptureType::CAPTURE_ALL_TRACKS &&
ContainsRestrictedContent()) {
return false;
}
return true;
Removing the if code block and recompiling should fix the issue.
Chromium has a similar restriction here ("Avoid capturing from EME-protected Media Elements" / "Stream capture not supported with EME"): https://chromium.googlesource.com/chromium/src/third_party/+/master/blink/renderer/modules/mediacapturefromelement/html_media_element_capture.cc#303
TO REPRODUCE
- With Widevine DRM enabled, go to https://bitmovin.com/demos/drm to test a DRM demo video.
- Play the video.
- Open the web console (Ctrl+Shift+K shortcut).
- Paste a JavaScript code using captureStream API to record a video, like the one on https://gist.github.com/lthrhx/610e94b03bed193f4a2e486baf20e477 and let the video end to trigger the file saving.
You can also just use the following test code which will produce an error with the name NS_ERROR_FAILURE if there is a restriction:
var video = document.getElementsByTagName("video")[0];
var stream = video.captureStream ? video.captureStream() : video.mozCaptureStream();
The code will not produce an error in the demo page when "Play DRM-controlled content" is OFF.
Since LibreWolf is designed with user freedom in mind, it should not prevent capturing restricted video. Like it could be done if people would customize and compile the Firefox source code.
_(mostly lifted from <https://github.com/BrowserWorks/Waterfox/issues/1895>, since the Waterfox developers refused to implement this with no real explanation. 5th most 👍'd issue by the way)_
**DESCRIBE THE BUG**
It is not possible to capture / record a restricted video because it is disabled in the official Firefox source code (captureStream API is disabled for DRM with Widevine / EME). The restriction / censorship source code seems to be currently located at line 4075 in the function `HTMLMediaElement::CanBeCaptured` of the file <https://searchfox.org/firefox-main/source/dom/media/mediaelement/HTMLMediaElement.cpp#4075>:
```cpp
// Prevent capturing restricted video
if (aCaptureType == StreamCaptureType::CAPTURE_ALL_TRACKS &&
ContainsRestrictedContent()) {
return false;
}
return true;
```
Removing the `if` code block and recompiling should fix the issue.
Chromium has a similar restriction here ("Avoid capturing from EME-protected Media Elements" / "Stream capture not supported with EME"): https://chromium.googlesource.com/chromium/src/third_party/+/master/blink/renderer/modules/mediacapturefromelement/html_media_element_capture.cc#303
**TO REPRODUCE**
1. With Widevine DRM enabled, go to https://bitmovin.com/demos/drm to test a DRM demo video.
2. Play the video.
3. Open the web console (Ctrl+Shift+K shortcut).
4. Paste a JavaScript code using captureStream API to record a video, like the one on https://gist.github.com/lthrhx/610e94b03bed193f4a2e486baf20e477 and let the video end to trigger the file saving.
You can also just use the following test code which will produce an error with the name `NS_ERROR_FAILURE` if there is a restriction:
```js
var video = document.getElementsByTagName("video")[0];
var stream = video.captureStream ? video.captureStream() : video.mozCaptureStream();
```
The code will not produce an error in the demo page when "Play DRM-controlled content" is OFF.
Since LibreWolf is designed with user freedom in mind, it should not prevent capturing restricted video. Like it could be done if people would customize and compile the Firefox source code.