Bug 1284548 - Use 'Share Audio' label for sharing audio played in <video>. r=? draft
authorIan Moody <moz-ian@perix.co.uk>
Sun, 03 Dec 2017 22:49:49 +0000
changeset 723205 ec1a48d7d543150c47585bc874b4a8a6faef4089
parent 723204 dce439ac348b240e907c4fe5c524bac4d804285c
child 746801 4ec6a70545fd3d0424a096c66a2d6dd82b455368
push id96364
push usermoz-ian@perix.co.uk
push dateMon, 22 Jan 2018 18:40:00 +0000
bugs1284548
milestone59.0a1
Bug 1284548 - Use 'Share Audio' label for sharing audio played in <video>. r=? Vary the 'Share [...]' label depending on the actual use of the <video> tag, as is done for the 'Save [...]' label. MozReview-Commit-ID: Ga6RqV5dCby
mobile/android/chrome/content/browser.js
mobile/android/locales/en-US/chrome/browser.properties
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -791,27 +791,31 @@ var BrowserApp = {
     NativeWindow.contextmenus.add(stringGetter("contextmenu.showControls2"),
       NativeWindow.contextmenus.mediaContext("media-hidingcontrols"),
       function(aTarget) {
         UITelemetry.addEvent("action.1", "contextmenu", null, "web_controls_media");
         aTarget.setAttribute("controls", true);
       });
 
     NativeWindow.contextmenus.add({
-      label: stringGetter("contextmenu.shareMedia"),
+      label: function(aTarget) {
+        return Strings.browser.GetStringFromName(
+          `contextmenu.share${videoClassifier(aTarget)}2`
+        );
+      },
       order: NativeWindow.contextmenus.DEFAULT_HTML5_ORDER - 1,
       selector: NativeWindow.contextmenus._disableRestricted(
         "SHARE", NativeWindow.contextmenus.videoContext()),
       showAsActions: function(aElement) {
         let url = (aElement.currentSrc || aElement.src);
         let title = aElement.textContent || aElement.title;
         return {
           title: title,
           uri: url,
-          type: "video/*",
+          type: videoClassifier(aElement) === "Audio" ? "audio/*" : "video/*",
         };
       },
       icon: "drawable://ic_menu_share",
       callback: function(aTarget) {
         // share.1 telemetry is handled in Java via PromptList
         UITelemetry.addEvent("action.1", "contextmenu", null, "web_share_media");
       }
     });
--- a/mobile/android/locales/en-US/chrome/browser.properties
+++ b/mobile/android/locales/en-US/chrome/browser.properties
@@ -310,17 +310,19 @@ contextmenu.setImageAs=Set Image As
 # significantly longer than the translation for the "Paste" action then this might trigger an
 # Android bug positioning the floating text selection partially off the screen. This issue heavily
 # depends on the screen size and the specific translations. For English "Paste" / "Add search engine"
 # is working while "Paste" / "Add as search engine" triggers the bug. See bug 1262098 for more details.
 # Manual testing the scenario described in bug 1262098 is highly recommended.
 contextmenu.addSearchEngine3=Add Search Engine
 contextmenu.playMedia=Play
 contextmenu.pauseMedia=Pause
-contextmenu.shareMedia=Share Video
+contextmenu.shareMedia2=Share Media
+contextmenu.shareVideo2=Share Video
+contextmenu.shareAudio2=Share Audio
 contextmenu.showControls2=Show Controls
 contextmenu.mute=Mute
 contextmenu.unmute=Unmute
 contextmenu.saveVideo=Save Video
 contextmenu.saveAudio=Save Audio
 # LOCALIZATION NOTE (contextmenu.saveMedia):
 # The label that will be used in the contextmenu in place of "Save Video" or "Save Audio", for
 # unloaded video elements.