Bug 881251 - Add mute/unmute to media context menus. r=lucasr

This commit is contained in:
Wes Johnston 2013-07-22 09:19:40 -07:00
parent 56737532c1
commit 823cf72112
2 changed files with 20 additions and 0 deletions

View File

@ -543,6 +543,18 @@ var BrowserApp = {
aTarget.mozRequestFullScreen();
});
NativeWindow.contextmenus.add(Strings.browser.GetStringFromName("contextmenu.mute"),
NativeWindow.contextmenus.mediaContext("media-unmuted"),
function(aTarget) {
aTarget.muted = true;
});
NativeWindow.contextmenus.add(Strings.browser.GetStringFromName("contextmenu.unmute"),
NativeWindow.contextmenus.mediaContext("media-muted"),
function(aTarget) {
aTarget.muted = false;
});
NativeWindow.contextmenus.add(Strings.browser.GetStringFromName("contextmenu.copyImageLocation"),
NativeWindow.contextmenus.imageLocationCopyableContext,
function(aTarget) {
@ -1942,6 +1954,12 @@ var NativeWindow = {
let controls = aElt.controls;
if (!controls && aMode == "media-hidingcontrols")
return true;
let muted = aElt.muted;
if (muted && aMode == "media-muted")
return true;
else if (!muted && aMode == "media-unmuted")
return true;
}
return false;
}

View File

@ -164,6 +164,8 @@ contextmenu.playMedia=Play
contextmenu.pauseMedia=Pause
contextmenu.shareMedia=Share Video
contextmenu.showControls2=Show Controls
contextmenu.mute=Mute
contextmenu.unmute=Unmute
contextmenu.saveVideo=Save Video
contextmenu.saveAudio=Save Audio
contextmenu.addToContacts=Add to Contacts