Sure, I'm happy to provide some direction on this bug, but because I'm not a peer of firefox component, the actual review would need to be done by [Firefox ownwers and peers](https://wiki.mozilla.org/Modules/All#Desktop_Firefox), eg. `:Gijs`. --- Ok, so the thing is that. Currently `Play Tab` uses the same [menu item](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/browser.xhtml#137) with the `Mute/Unmute Tab`. We adjust its label [here](https://searchfox.org/mozilla-central/source/browser/base/content/tabbrowser.js#6640-6643) and the actual [implementation](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/tabbrowser-tab.js#598-603) for `Play tab` is in the same function `toggleMuteAudio()`. Therefore, here are something we need to do. 1. create a new `menu item` for `Play tab`, which should be hidden in the beginning (`hidden="true"`). Because this menu should only appear when we postpone the autoplay. (see [UX spec](https://mozilla.invisionapp.com/share/K48PCVSEM#/screens/190748307) for more details about why we need `Play Tab`) 2. create a new function (eg, `resumeDelayedMedia()`) and move the `Play tab` implementation in `toggleMuteAudio()` to that new function. Then set it to `oncommand` attribute of the menu item you created in the step1. 3. Now we don't need to set the `Play tab` label to the menu item for `Mute tab`, so we need to remove [that](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/tabbrowser.js#6641-6643). In contrary, we have to detemine if we want to show the menu item for `Play tab` or not. If tab has attribute `activemedia-blocked`, then set the hidden state of the menu item to `false`. 4. Add the function you created in step2 to [here](https://searchfox.org/mozilla-central/source/browser/base/content/tabbrowser.js#4821) , then to determine whether calling `toggleMuteAudio()` or the function you created in step2 depending on if tab has attribute `activemedia-blocked` or not. 5. Do similar thing as step4 [here](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/tabbrowser-tab.js#422), which also determine whether calling `toggleMuteAudio()` or the function you created in step2 depending on if tab has attribute `activemedia-blocked` or not. So after these steps, you would create a new menu item for `play tab` when selecting single tab. --- (bonus, remove handling `play tab` on multiple selected tabs) That is slightly out of the scope of this bug, which is also more complicated. In our intial design, we didn't propose to have this feature on multiple selected tabs, because playing multiple tabs at the same time would violate the original goal we want to achieve. So I don't know why they add this on multiple tabs selection. So I personally lean to remove that, and that won't need to be done in this bug.
Bug 1684876 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Sure, I'm happy to provide some direction on this bug, but because I'm not a peer of firefox component, the actual review would need to be done by [Firefox ownwers and peers](https://wiki.mozilla.org/Modules/All#Desktop_Firefox), eg. :Gijs --- Ok, so the thing is that. Currently "Play Tab" uses the same [menu item](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/browser.xhtml#137) with the "Mute/Unmute Tab". We adjust its label [here](https://searchfox.org/mozilla-central/source/browser/base/content/tabbrowser.js#6640-6643) and the actual [implementation](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/tabbrowser-tab.js#598-603) for "Play tab" is in the same function `toggleMuteAudio()`. Therefore, here are something we need to do. 1. create a new "menu item" for "Play tab", which should be hidden in the beginning (`hidden="true"`). Because this menu should only appear when we postpone the autoplay. (see [UX spec](https://mozilla.invisionapp.com/share/K48PCVSEM#/screens/190748307) for more details about why we need "Play Tab") 2. create a new function (eg, `resumeDelayedMedia()`) and move the "Play tab" implementation in `toggleMuteAudio()` to that new function. Then set it to `oncommand` attribute of the menu item you created in the step1. 3. Now we don't need to set the "Play tab" label to the menu item for "Mute tab", so we need to remove [that](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/tabbrowser.js#6641-6643). In contrary, we have to detemine if we want to show the menu item for "Play tab" or not. If tab has attribute `activemedia-blocked`, then set the hidden state of the menu item to `false`. 4. Add the function you created in the step2 to [here](https://searchfox.org/mozilla-central/source/browser/base/content/tabbrowser.js#4821) , then to determine whether calling `toggleMuteAudio()` or the function you created in the step2 depending on if tab has attribute `activemedia-blocked` or not. 5. Do similar thing as the step4 [here](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/tabbrowser-tab.js#422), which also determine whether calling `toggleMuteAudio()` or the function you created in the step2 depending on if tab has attribute `activemedia-blocked` or not. So after these steps, you are able to create a new menu item for "play tab" when selecting single tab. --- (bonus, remove handling "play tab" on multiple selected tabs) That is slightly out of the scope of this bug, which is also more complicated. In our intial design, we didn't propose to have this feature on multiple selected tabs, because playing multiple tabs at the same time would violate the original goal we want to achieve. So I don't know why they add this on multiple tabs selection. So I personally lean to remove that, and that won't need to be done in this bug.
Sure, I'm happy to provide some direction on this bug, but because I'm not a peer of firefox component, the actual review would need to be done by [Firefox ownwers and peers](https://wiki.mozilla.org/Modules/All#Desktop_Firefox), eg. :Gijs --- Ok, so the thing is that. Currently "Play Tab" uses the same [menu item](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/browser.xhtml#137) with the "Mute/Unmute Tab". We adjust its label [here](https://searchfox.org/mozilla-central/source/browser/base/content/tabbrowser.js#6640-6643) and the actual [implementation](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/tabbrowser-tab.js#598-603) for "Play tab" is in the same function `toggleMuteAudio()`. Therefore, here are something we need to do. 1. create a new "menu item" for "Play tab", which should be hidden in the beginning (`hidden="true"`). Because this menu should only appear when we postpone the autoplay. (see [UX spec](https://mozilla.invisionapp.com/share/K48PCVSEM#/screens/190748307) for more details about why we need "Play Tab") 2. create a new function (eg, `resumeDelayedMedia()`) and move the "Play tab" implementation in `toggleMuteAudio()` to that new function. Then set it to `oncommand` attribute of the menu item you created in the step1. 3. Now we don't need to set the "Play tab" label to the menu item for "Mute tab", so we need to remove [that](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/tabbrowser.js#6641-6643). In contrary, we have to detemine if we want to show the menu item for "Play tab" or not. If tab has attribute `activemedia-blocked`, then set the hidden state of the menu item to `false`. 4. Add the function you created in the step2 to [here](https://searchfox.org/mozilla-central/source/browser/base/content/tabbrowser.js#4821) , then to determine whether calling `toggleMuteAudio()` or the function you created in the step2 depending on if tab has attribute `activemedia-blocked` or not. 5. Do similar thing as the step4 [here](https://searchfox.org/mozilla-central/rev/ef900cd2258d4c5d968093f612f807d96e6e7c98/browser/base/content/tabbrowser-tab.js#422), which also determine whether calling `toggleMuteAudio()` or the function you created in the step2 depending on if tab has attribute `activemedia-blocked` or not. So after these steps, you are able to create a new menu item for "play tab" when selecting single tab. --- (bonus, remove handling "play tab" on multiple selected tabs) That is slightly out of the scope of this bug, which is also more complicated. In our initial design, we didn't propose to have this feature on multiple selected tabs, because playing multiple tabs at the same time would violate the original goal we want to achieve. So I don't know why they add this on multiple tabs selection. So I personally lean to remove that, and that won't need to be done in this bug.