зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1156472 - Part 9 - Implement the minimum frontend to play with the feature. r=gijs,florian
This commit is contained in:
Родитель
5ed058488a
Коммит
4397423937
|
@ -758,6 +758,7 @@ you can use these alternative items. Otherwise, their values should be empty. -
|
||||||
<!ENTITY getUserMedia.selectCamera.accesskey "C">
|
<!ENTITY getUserMedia.selectCamera.accesskey "C">
|
||||||
<!ENTITY getUserMedia.selectMicrophone.label "Microphone to share:">
|
<!ENTITY getUserMedia.selectMicrophone.label "Microphone to share:">
|
||||||
<!ENTITY getUserMedia.selectMicrophone.accesskey "M">
|
<!ENTITY getUserMedia.selectMicrophone.accesskey "M">
|
||||||
|
<!ENTITY getUserMedia.audioCapture.label "Audio from the tab will be shared.">
|
||||||
<!ENTITY getUserMedia.allWindowsShared.message "All visible windows on your screen will be shared.">
|
<!ENTITY getUserMedia.allWindowsShared.message "All visible windows on your screen will be shared.">
|
||||||
|
|
||||||
<!-- Bad Content Blocker Doorhanger Notification -->
|
<!-- Bad Content Blocker Doorhanger Notification -->
|
||||||
|
|
|
@ -553,13 +553,17 @@ identity.loggedIn.signOut.accessKey = O
|
||||||
|
|
||||||
# LOCALIZATION NOTE (getUserMedia.shareCamera.message, getUserMedia.shareMicrophone.message,
|
# LOCALIZATION NOTE (getUserMedia.shareCamera.message, getUserMedia.shareMicrophone.message,
|
||||||
# getUserMedia.shareScreen.message, getUserMedia.shareCameraAndMicrophone.message,
|
# getUserMedia.shareScreen.message, getUserMedia.shareCameraAndMicrophone.message,
|
||||||
# getUserMedia.shareScreenAndMicrophone.message):
|
# getUserMedia.shareScreenAndMicrophone.message, getUserMedia.shareCameraAndAudioCapture.message,
|
||||||
|
# getUserMedia.shareAudioCapture.message, getUserMedia.shareScreenAndAudioCapture.message):
|
||||||
# %S is the website origin (e.g. www.mozilla.org)
|
# %S is the website origin (e.g. www.mozilla.org)
|
||||||
getUserMedia.shareCamera.message = Would you like to share your camera with %S?
|
getUserMedia.shareCamera.message = Would you like to share your camera with %S?
|
||||||
getUserMedia.shareMicrophone.message = Would you like to share your microphone with %S?
|
getUserMedia.shareMicrophone.message = Would you like to share your microphone with %S?
|
||||||
getUserMedia.shareScreen.message = Would you like to share your screen with %S?
|
getUserMedia.shareScreen.message = Would you like to share your screen with %S?
|
||||||
getUserMedia.shareCameraAndMicrophone.message = Would you like to share your camera and microphone with %S?
|
getUserMedia.shareCameraAndMicrophone.message = Would you like to share your camera and microphone with %S?
|
||||||
|
getUserMedia.shareCameraAndAudioCapture.message = Would you like to share your camera and this tab's audio with %S?
|
||||||
getUserMedia.shareScreenAndMicrophone.message = Would you like to share your microphone and screen with %S?
|
getUserMedia.shareScreenAndMicrophone.message = Would you like to share your microphone and screen with %S?
|
||||||
|
getUserMedia.shareScreenAndAudioCapture.message = Would you like to share this tab's audio and your screen with %S?
|
||||||
|
getUserMedia.shareAudioCapture.message = Would you like to share this tab's audio with %S?
|
||||||
getUserMedia.selectWindow.label=Window to share:
|
getUserMedia.selectWindow.label=Window to share:
|
||||||
getUserMedia.selectWindow.accesskey=W
|
getUserMedia.selectWindow.accesskey=W
|
||||||
getUserMedia.selectScreen.label=Screen to share:
|
getUserMedia.selectScreen.label=Screen to share:
|
||||||
|
@ -601,6 +605,7 @@ getUserMedia.sharingApplication.message = You are currently sharing an applicati
|
||||||
getUserMedia.sharingScreen.message = You are currently sharing your screen with this page.
|
getUserMedia.sharingScreen.message = You are currently sharing your screen with this page.
|
||||||
getUserMedia.sharingWindow.message = You are currently sharing a window with this page.
|
getUserMedia.sharingWindow.message = You are currently sharing a window with this page.
|
||||||
getUserMedia.sharingBrowser.message = You are currently sharing a tab with this page.
|
getUserMedia.sharingBrowser.message = You are currently sharing a tab with this page.
|
||||||
|
getUserMedia.sharingAudioCapture.message = You are currently sharing a tab's audio with this page.
|
||||||
getUserMedia.continueSharing.label = Continue Sharing
|
getUserMedia.continueSharing.label = Continue Sharing
|
||||||
getUserMedia.continueSharing.accesskey = C
|
getUserMedia.continueSharing.accesskey = C
|
||||||
getUserMedia.stopSharing.label = Stop Sharing
|
getUserMedia.stopSharing.label = Stop Sharing
|
||||||
|
@ -610,6 +615,7 @@ getUserMedia.sharingMenu.label = Tabs sharing devices
|
||||||
getUserMedia.sharingMenu.accesskey = d
|
getUserMedia.sharingMenu.accesskey = d
|
||||||
# LOCALIZATION NOTE (getUserMedia.sharingMenuCamera
|
# LOCALIZATION NOTE (getUserMedia.sharingMenuCamera
|
||||||
# getUserMedia.sharingMenuMicrophone,
|
# getUserMedia.sharingMenuMicrophone,
|
||||||
|
# getUserMedia.sharingMenuAudioCapture,
|
||||||
# getUserMedia.sharingMenuApplication,
|
# getUserMedia.sharingMenuApplication,
|
||||||
# getUserMedia.sharingMenuScreen,
|
# getUserMedia.sharingMenuScreen,
|
||||||
# getUserMedia.sharingMenuWindow,
|
# getUserMedia.sharingMenuWindow,
|
||||||
|
@ -619,6 +625,11 @@ getUserMedia.sharingMenu.accesskey = d
|
||||||
# getUserMedia.sharingMenuCameraMicrophoneScreen,
|
# getUserMedia.sharingMenuCameraMicrophoneScreen,
|
||||||
# getUserMedia.sharingMenuCameraMicrophoneWindow,
|
# getUserMedia.sharingMenuCameraMicrophoneWindow,
|
||||||
# getUserMedia.sharingMenuCameraMicrophoneBrowser,
|
# getUserMedia.sharingMenuCameraMicrophoneBrowser,
|
||||||
|
# getUserMedia.sharingMenuCameraAudioCapture,
|
||||||
|
# getUserMedia.sharingMenuCameraAudioCaptureApplication,
|
||||||
|
# getUserMedia.sharingMenuCameraAudioCaptureScreen,
|
||||||
|
# getUserMedia.sharingMenuCameraAudioCaptureWindow,
|
||||||
|
# getUserMedia.sharingMenuCameraAudioCaptureBrowser,
|
||||||
# getUserMedia.sharingMenuCameraApplication,
|
# getUserMedia.sharingMenuCameraApplication,
|
||||||
# getUserMedia.sharingMenuCameraScreen,
|
# getUserMedia.sharingMenuCameraScreen,
|
||||||
# getUserMedia.sharingMenuCameraWindow,
|
# getUserMedia.sharingMenuCameraWindow,
|
||||||
|
@ -630,6 +641,7 @@ getUserMedia.sharingMenu.accesskey = d
|
||||||
# %S is the website origin (e.g. www.mozilla.org)
|
# %S is the website origin (e.g. www.mozilla.org)
|
||||||
getUserMedia.sharingMenuCamera = %S (camera)
|
getUserMedia.sharingMenuCamera = %S (camera)
|
||||||
getUserMedia.sharingMenuMicrophone = %S (microphone)
|
getUserMedia.sharingMenuMicrophone = %S (microphone)
|
||||||
|
getUserMedia.sharingMenuAudioCapture = %S (tab audio)
|
||||||
getUserMedia.sharingMenuApplication = %S (application)
|
getUserMedia.sharingMenuApplication = %S (application)
|
||||||
getUserMedia.sharingMenuScreen = %S (screen)
|
getUserMedia.sharingMenuScreen = %S (screen)
|
||||||
getUserMedia.sharingMenuWindow = %S (window)
|
getUserMedia.sharingMenuWindow = %S (window)
|
||||||
|
@ -639,6 +651,11 @@ getUserMedia.sharingMenuCameraMicrophoneApplication = %S (camera, microphone and
|
||||||
getUserMedia.sharingMenuCameraMicrophoneScreen = %S (camera, microphone and screen)
|
getUserMedia.sharingMenuCameraMicrophoneScreen = %S (camera, microphone and screen)
|
||||||
getUserMedia.sharingMenuCameraMicrophoneWindow = %S (camera, microphone and window)
|
getUserMedia.sharingMenuCameraMicrophoneWindow = %S (camera, microphone and window)
|
||||||
getUserMedia.sharingMenuCameraMicrophoneBrowser = %S (camera, microphone and tab)
|
getUserMedia.sharingMenuCameraMicrophoneBrowser = %S (camera, microphone and tab)
|
||||||
|
getUserMedia.sharingMenuCameraAudioCapture = %S (camera and tab audio)
|
||||||
|
getUserMedia.sharingMenuCameraAudioCaptureApplication = %S (camera, tab audio and application)
|
||||||
|
getUserMedia.sharingMenuCameraAudioCaptureScreen = %S (camera, tab audio and screen)
|
||||||
|
getUserMedia.sharingMenuCameraAudioCaptureWindow = %S (camera, tab audio and window)
|
||||||
|
getUserMedia.sharingMenuCameraAudioCaptureBrowser = %S (camera, tab audio and tab)
|
||||||
getUserMedia.sharingMenuCameraApplication = %S (camera and application)
|
getUserMedia.sharingMenuCameraApplication = %S (camera and application)
|
||||||
getUserMedia.sharingMenuCameraScreen = %S (camera and screen)
|
getUserMedia.sharingMenuCameraScreen = %S (camera and screen)
|
||||||
getUserMedia.sharingMenuCameraWindow = %S (camera and window)
|
getUserMedia.sharingMenuCameraWindow = %S (camera and window)
|
||||||
|
@ -647,6 +664,10 @@ getUserMedia.sharingMenuMicrophoneApplication = %S (microphone and application)
|
||||||
getUserMedia.sharingMenuMicrophoneScreen = %S (microphone and screen)
|
getUserMedia.sharingMenuMicrophoneScreen = %S (microphone and screen)
|
||||||
getUserMedia.sharingMenuMicrophoneWindow = %S (microphone and window)
|
getUserMedia.sharingMenuMicrophoneWindow = %S (microphone and window)
|
||||||
getUserMedia.sharingMenuMicrophoneBrowser = %S (microphone and tab)
|
getUserMedia.sharingMenuMicrophoneBrowser = %S (microphone and tab)
|
||||||
|
getUserMedia.sharingMenuMicrophoneApplication = %S (tab audio and application)
|
||||||
|
getUserMedia.sharingMenuMicrophoneScreen = %S (tab audio and screen)
|
||||||
|
getUserMedia.sharingMenuMicrophoneWindow = %S (tab audio and window)
|
||||||
|
getUserMedia.sharingMenuMicrophoneBrowser = %S (tab audio and tab)
|
||||||
# LOCALIZATION NOTE(getUserMedia.sharingMenuUnknownHost): this is used for the website
|
# LOCALIZATION NOTE(getUserMedia.sharingMenuUnknownHost): this is used for the website
|
||||||
# origin for the sharing menu if no readable origin could be deduced from the URL.
|
# origin for the sharing menu if no readable origin could be deduced from the URL.
|
||||||
getUserMedia.sharingMenuUnknownHost = Unknown origin
|
getUserMedia.sharingMenuUnknownHost = Unknown origin
|
||||||
|
|
|
@ -86,14 +86,21 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec
|
||||||
|
|
||||||
// MediaStreamConstraints defines video as 'boolean or MediaTrackConstraints'.
|
// MediaStreamConstraints defines video as 'boolean or MediaTrackConstraints'.
|
||||||
let video = aConstraints.video || aConstraints.picture;
|
let video = aConstraints.video || aConstraints.picture;
|
||||||
|
let audio = aConstraints.audio;
|
||||||
let sharingScreen = video && typeof(video) != "boolean" &&
|
let sharingScreen = video && typeof(video) != "boolean" &&
|
||||||
video.mediaSource != "camera";
|
video.mediaSource != "camera";
|
||||||
|
let sharingAudio = audio && typeof(audio) != "boolean" &&
|
||||||
|
audio.mediaSource != "microphone";
|
||||||
for (let device of aDevices) {
|
for (let device of aDevices) {
|
||||||
device = device.QueryInterface(Ci.nsIMediaDevice);
|
device = device.QueryInterface(Ci.nsIMediaDevice);
|
||||||
switch (device.type) {
|
switch (device.type) {
|
||||||
case "audio":
|
case "audio":
|
||||||
if (aConstraints.audio) {
|
// Check that if we got a microphone, we have not requested an audio
|
||||||
audioDevices.push({name: device.name, deviceIndex: devices.length});
|
// capture, and if we have requested an audio capture, we are not
|
||||||
|
// getting a microphone instead.
|
||||||
|
if (audio && (device.mediaSource == "microphone") != sharingAudio) {
|
||||||
|
audioDevices.push({name: device.name, deviceIndex: devices.length,
|
||||||
|
mediaSource: device.mediaSource});
|
||||||
devices.push(device);
|
devices.push(device);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -113,7 +120,7 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec
|
||||||
if (videoDevices.length)
|
if (videoDevices.length)
|
||||||
requestTypes.push(sharingScreen ? "Screen" : "Camera");
|
requestTypes.push(sharingScreen ? "Screen" : "Camera");
|
||||||
if (audioDevices.length)
|
if (audioDevices.length)
|
||||||
requestTypes.push("Microphone");
|
requestTypes.push(sharingAudio ? "AudioCapture" : "Microphone");
|
||||||
|
|
||||||
if (!requestTypes.length) {
|
if (!requestTypes.length) {
|
||||||
denyRequest({callID: aCallID}, "NotFoundError");
|
denyRequest({callID: aCallID}, "NotFoundError");
|
||||||
|
@ -133,6 +140,7 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec
|
||||||
secure: aSecure,
|
secure: aSecure,
|
||||||
requestTypes: requestTypes,
|
requestTypes: requestTypes,
|
||||||
sharingScreen: sharingScreen,
|
sharingScreen: sharingScreen,
|
||||||
|
sharingAudio: sharingAudio,
|
||||||
audioDevices: audioDevices,
|
audioDevices: audioDevices,
|
||||||
videoDevices: videoDevices
|
videoDevices: videoDevices
|
||||||
};
|
};
|
||||||
|
|
|
@ -188,7 +188,8 @@ function getHost(uri, href) {
|
||||||
|
|
||||||
function prompt(aBrowser, aRequest) {
|
function prompt(aBrowser, aRequest) {
|
||||||
let {audioDevices: audioDevices, videoDevices: videoDevices,
|
let {audioDevices: audioDevices, videoDevices: videoDevices,
|
||||||
sharingScreen: sharingScreen, requestTypes: requestTypes} = aRequest;
|
sharingScreen: sharingScreen, sharingAudio: sharingAudio,
|
||||||
|
requestTypes: requestTypes} = aRequest;
|
||||||
let uri = Services.io.newURI(aRequest.documentURI, null, null);
|
let uri = Services.io.newURI(aRequest.documentURI, null, null);
|
||||||
let host = getHost(uri);
|
let host = getHost(uri);
|
||||||
let chromeDoc = aBrowser.ownerDocument;
|
let chromeDoc = aBrowser.ownerDocument;
|
||||||
|
@ -198,10 +199,9 @@ function prompt(aBrowser, aRequest) {
|
||||||
let message = stringBundle.getFormattedString(stringId, [host]);
|
let message = stringBundle.getFormattedString(stringId, [host]);
|
||||||
|
|
||||||
let mainLabel;
|
let mainLabel;
|
||||||
if (sharingScreen) {
|
if (sharingScreen || sharingAudio) {
|
||||||
mainLabel = stringBundle.getString("getUserMedia.shareSelectedItems.label");
|
mainLabel = stringBundle.getString("getUserMedia.shareSelectedItems.label");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
let string = stringBundle.getString("getUserMedia.shareSelectedDevices.label");
|
let string = stringBundle.getString("getUserMedia.shareSelectedDevices.label");
|
||||||
mainLabel = PluralForm.get(requestTypes.length, string);
|
mainLabel = PluralForm.get(requestTypes.length, string);
|
||||||
}
|
}
|
||||||
|
@ -225,8 +225,8 @@ function prompt(aBrowser, aRequest) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
// Bug 1037438: implement 'never' for screen sharing.
|
||||||
if (!sharingScreen) { // Bug 1037438: implement 'never' for screen sharing.
|
if (!sharingScreen && !sharingAudio) {
|
||||||
secondaryActions.push({
|
secondaryActions.push({
|
||||||
label: stringBundle.getString("getUserMedia.never.label"),
|
label: stringBundle.getString("getUserMedia.never.label"),
|
||||||
accessKey: stringBundle.getString("getUserMedia.never.accesskey"),
|
accessKey: stringBundle.getString("getUserMedia.never.accesskey"),
|
||||||
|
@ -243,10 +243,10 @@ function prompt(aBrowser, aRequest) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aRequest.secure && !sharingScreen) {
|
if (aRequest.secure && !sharingScreen && !sharingAudio) {
|
||||||
// Don't show the 'Always' action if the connection isn't secure, or for
|
// Don't show the 'Always' action if the connection isn't secure, or for
|
||||||
// screen sharing (because we can't guess which window the user wants to
|
// screen/audio sharing (because we can't guess which window the user wants
|
||||||
// share without prompting).
|
// to share without prompting).
|
||||||
secondaryActions.unshift({
|
secondaryActions.unshift({
|
||||||
label: stringBundle.getString("getUserMedia.always.label"),
|
label: stringBundle.getString("getUserMedia.always.label"),
|
||||||
accessKey: stringBundle.getString("getUserMedia.always.accesskey"),
|
accessKey: stringBundle.getString("getUserMedia.always.accesskey"),
|
||||||
|
@ -266,7 +266,8 @@ function prompt(aBrowser, aRequest) {
|
||||||
if (aTopic == "shown") {
|
if (aTopic == "shown") {
|
||||||
let PopupNotifications = chromeDoc.defaultView.PopupNotifications;
|
let PopupNotifications = chromeDoc.defaultView.PopupNotifications;
|
||||||
let popupId = "Devices";
|
let popupId = "Devices";
|
||||||
if (requestTypes.length == 1 && requestTypes[0] == "Microphone")
|
if (requestTypes.length == 1 && (requestTypes[0] == "Microphone" ||
|
||||||
|
requestTypes[0] == "AudioCapture"))
|
||||||
popupId = "Microphone";
|
popupId = "Microphone";
|
||||||
if (requestTypes.indexOf("Screen") != -1)
|
if (requestTypes.indexOf("Screen") != -1)
|
||||||
popupId = "Screen";
|
popupId = "Screen";
|
||||||
|
@ -384,7 +385,7 @@ function prompt(aBrowser, aRequest) {
|
||||||
|
|
||||||
chromeDoc.getElementById("webRTC-selectCamera").hidden = !videoDevices.length || sharingScreen;
|
chromeDoc.getElementById("webRTC-selectCamera").hidden = !videoDevices.length || sharingScreen;
|
||||||
chromeDoc.getElementById("webRTC-selectWindowOrScreen").hidden = !sharingScreen || !videoDevices.length;
|
chromeDoc.getElementById("webRTC-selectWindowOrScreen").hidden = !sharingScreen || !videoDevices.length;
|
||||||
chromeDoc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length;
|
chromeDoc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length || sharingAudio;
|
||||||
|
|
||||||
let camMenupopup = chromeDoc.getElementById("webRTC-selectCamera-menupopup");
|
let camMenupopup = chromeDoc.getElementById("webRTC-selectCamera-menupopup");
|
||||||
let windowMenupopup = chromeDoc.getElementById("webRTC-selectWindow-menupopup");
|
let windowMenupopup = chromeDoc.getElementById("webRTC-selectWindow-menupopup");
|
||||||
|
@ -393,11 +394,15 @@ function prompt(aBrowser, aRequest) {
|
||||||
listScreenShareDevices(windowMenupopup, videoDevices);
|
listScreenShareDevices(windowMenupopup, videoDevices);
|
||||||
else
|
else
|
||||||
listDevices(camMenupopup, videoDevices);
|
listDevices(camMenupopup, videoDevices);
|
||||||
|
|
||||||
|
if (!sharingAudio)
|
||||||
listDevices(micMenupopup, audioDevices);
|
listDevices(micMenupopup, audioDevices);
|
||||||
|
|
||||||
if (requestTypes.length == 2) {
|
if (requestTypes.length == 2) {
|
||||||
let stringBundle = chromeDoc.defaultView.gNavigatorBundle;
|
let stringBundle = chromeDoc.defaultView.gNavigatorBundle;
|
||||||
if (!sharingScreen)
|
if (!sharingScreen)
|
||||||
addDeviceToList(camMenupopup, stringBundle.getString("getUserMedia.noVideo.label"), "-1");
|
addDeviceToList(camMenupopup, stringBundle.getString("getUserMedia.noVideo.label"), "-1");
|
||||||
|
if (!sharingAudio)
|
||||||
addDeviceToList(micMenupopup, stringBundle.getString("getUserMedia.noAudio.label"), "-1");
|
addDeviceToList(micMenupopup, stringBundle.getString("getUserMedia.noAudio.label"), "-1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,6 +421,7 @@ function prompt(aBrowser, aRequest) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (audioDevices.length) {
|
if (audioDevices.length) {
|
||||||
|
if (!sharingAudio) {
|
||||||
let audioDeviceIndex = chromeDoc.getElementById("webRTC-selectMicrophone-menulist").value;
|
let audioDeviceIndex = chromeDoc.getElementById("webRTC-selectMicrophone-menulist").value;
|
||||||
let allowMic = audioDeviceIndex != "-1";
|
let allowMic = audioDeviceIndex != "-1";
|
||||||
if (allowMic)
|
if (allowMic)
|
||||||
|
@ -424,6 +430,10 @@ function prompt(aBrowser, aRequest) {
|
||||||
perms.add(uri, "microphone",
|
perms.add(uri, "microphone",
|
||||||
allowMic ? perms.ALLOW_ACTION : perms.DENY_ACTION);
|
allowMic ? perms.ALLOW_ACTION : perms.DENY_ACTION);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Only one device possible for audio capture.
|
||||||
|
allowedDevices.push(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allowedDevices.length) {
|
if (!allowedDevices.length) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче