|
|
d675653 |
diff --git a/browser/actors/WebRTCParent.jsm b/browser/actors/WebRTCParent.jsm
|
|
|
d675653 |
--- a/browser/actors/WebRTCParent.jsm
|
|
|
d675653 |
+++ b/browser/actors/WebRTCParent.jsm
|
|
|
d675653 |
@@ -756,6 +756,8 @@
|
|
|
d675653 |
);
|
|
|
d675653 |
menupopup.appendChild(doc.createXULElement("menuseparator"));
|
|
|
d675653 |
|
|
|
d675653 |
+ let isPipeWire = false;
|
|
|
d675653 |
+
|
|
|
d675653 |
// Build the list of 'devices'.
|
|
|
d675653 |
let monitorIndex = 1;
|
|
|
d675653 |
for (let i = 0; i < devices.length; ++i) {
|
|
|
d675653 |
@@ -783,6 +785,7 @@
|
|
|
d675653 |
// Don't mark it as scary as there's an extra confirmation step by
|
|
|
d675653 |
// PipeWire portal dialog.
|
|
|
d675653 |
if (name == PIPEWIRE_PORTAL_NAME && device.id == PIPEWIRE_ID) {
|
|
|
d675653 |
+ isPipeWire = true;
|
|
|
d675653 |
let sawcStringId = "getUserMedia.sharePipeWirePortal.label";
|
|
|
d675653 |
let item = addDeviceToList(
|
|
|
d675653 |
menupopup,
|
|
|
d675653 |
@@ -908,39 +911,41 @@
|
|
|
d675653 |
perms.EXPIRE_SESSION
|
|
|
d675653 |
);
|
|
|
d675653 |
|
|
|
d675653 |
- video.deviceId = deviceId;
|
|
|
d675653 |
- let constraints = {
|
|
|
d675653 |
- video: { mediaSource: type, deviceId: { exact: deviceId } },
|
|
|
d675653 |
- };
|
|
|
d675653 |
- chromeWin.navigator.mediaDevices.getUserMedia(constraints).then(
|
|
|
d675653 |
- stream => {
|
|
|
d675653 |
- if (video.deviceId != deviceId) {
|
|
|
d675653 |
- // The user has selected a different device or closed the panel
|
|
|
d675653 |
- // before getUserMedia finished.
|
|
|
d675653 |
- stream.getTracks().forEach(t => t.stop());
|
|
|
d675653 |
- return;
|
|
|
d675653 |
+ if (!isPipeWire) {
|
|
|
d675653 |
+ video.deviceId = deviceId;
|
|
|
d675653 |
+ let constraints = {
|
|
|
d675653 |
+ video: { mediaSource: type, deviceId: { exact: deviceId } },
|
|
|
d675653 |
+ };
|
|
|
d675653 |
+ chromeWin.navigator.mediaDevices.getUserMedia(constraints).then(
|
|
|
d675653 |
+ stream => {
|
|
|
d675653 |
+ if (video.deviceId != deviceId) {
|
|
|
d675653 |
+ // The user has selected a different device or closed the panel
|
|
|
d675653 |
+ // before getUserMedia finished.
|
|
|
d675653 |
+ stream.getTracks().forEach(t => t.stop());
|
|
|
d675653 |
+ return;
|
|
|
d675653 |
+ }
|
|
|
d675653 |
+ video.srcObject = stream;
|
|
|
d675653 |
+ video.stream = stream;
|
|
|
d675653 |
+ doc.getElementById("webRTC-preview").hidden = false;
|
|
|
d675653 |
+ video.onloadedmetadata = function(e) {
|
|
|
d675653 |
+ video.play();
|
|
|
d675653 |
+ };
|
|
|
d675653 |
+ },
|
|
|
d675653 |
+ err => {
|
|
|
d675653 |
+ if (
|
|
|
d675653 |
+ err.name == "OverconstrainedError" &&
|
|
|
d675653 |
+ err.constraint == "deviceId"
|
|
|
d675653 |
+ ) {
|
|
|
d675653 |
+ // Window has disappeared since enumeration, which can happen.
|
|
|
d675653 |
+ // No preview for you.
|
|
|
d675653 |
+ return;
|
|
|
d675653 |
+ }
|
|
|
d675653 |
+ Cu.reportError(
|
|
|
d675653 |
+ `error in preview: ${err.message} ${err.constraint}`
|
|
|
d675653 |
+ );
|
|
|
d675653 |
}
|
|
|
d675653 |
- video.srcObject = stream;
|
|
|
d675653 |
- video.stream = stream;
|
|
|
d675653 |
- doc.getElementById("webRTC-preview").hidden = false;
|
|
|
d675653 |
- video.onloadedmetadata = function(e) {
|
|
|
d675653 |
- video.play();
|
|
|
d675653 |
- };
|
|
|
d675653 |
- },
|
|
|
d675653 |
- err => {
|
|
|
d675653 |
- if (
|
|
|
d675653 |
- err.name == "OverconstrainedError" &&
|
|
|
d675653 |
- err.constraint == "deviceId"
|
|
|
d675653 |
- ) {
|
|
|
d675653 |
- // Window has disappeared since enumeration, which can happen.
|
|
|
d675653 |
- // No preview for you.
|
|
|
d675653 |
- return;
|
|
|
d675653 |
- }
|
|
|
d675653 |
- Cu.reportError(
|
|
|
d675653 |
- `error in preview: ${err.message} ${err.constraint}`
|
|
|
d675653 |
- );
|
|
|
d675653 |
- }
|
|
|
d675653 |
- );
|
|
|
d675653 |
+ );
|
|
|
d675653 |
+ }
|
|
|
d675653 |
};
|
|
|
d675653 |
menupopup.addEventListener("command", menupopup._commandEventListener);
|
|
|
d675653 |
}
|
|
|
d675653 |
|