Closed Bug 1478875 Opened 6 years ago Closed 6 years ago

add different default layout for autoplay prompt

Categories

(Core :: Audio/Video: Playback, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: alwu, Assigned: alwu)

References

Details

Attachments

(1 obsolete file)

In our shield-study, we want to provide different layout of prompt to different user groups.

We need 4 different layouts for the default prompt.
1) [Allow], [Remember this decision] unchecked
2) [Don’t Allow], [Remember this decision] unchecked
3) [Allow], [Remember this decision] checked
4) [Don’t Allow], [Remember this decision] checked
Summary: change layout of autoplay prompt → add different default layout for autoplay prompt
Comment on attachment 8995377 [details]
Bug 1478875 - add different default layout for autoplay prompt.

https://reviewboard.mozilla.org/r/259832/#review267020

I am not actually a peer here so this will need a peer review, johannh is who I have been asking but is on PTO at the moment, before the 31st I believe r=florian is best to check on this

::: browser/modules/PermissionUI.jsm:843
(Diff revision 1)
> +    if (layout == 0 || layout == 2) {
> +      actions.push(allowAction, denyAction);
> +    } else {
> +      actions.push(denyAction, allowAction);
> +    }
> +    return actions;

nit

    if (layout == 0 || layout == 2) {
      return [allowAction, denyAction];
     } 
     return [denyAction, allowAction];

Seems a tad cleaner imo, although wouldnt block on it
Attachment #8995377 - Flags: review?(dharvey) → review+
Comment on attachment 8995377 [details]
Bug 1478875 - add different default layout for autoplay prompt.

https://reviewboard.mozilla.org/r/259832/#review267292

I see Johann suggested using a WebExtension Experiment in comment 4, has this option been explored?

It should be possible to modify PermissionUI.AutoplayPermissionPrompt.prototype from a WebExtension Experiment.

If this turns out to be impossible or extremely difficult I would be OK with the approach in the current patch.

::: modules/libpref/init/all.js:570
(Diff revision 2)
>  
>  // Whether to autostart a media element with an |autoplay| attribute.
>  // ALLOWED=0, BLOCKED=1, PROMPT=2, defined in dom/media/Autoplay.idl
>  pref("media.autoplay.default", 0);
>  
> +// Use to control the default setting layout of doorhanger.

I would add "for a Shield study" at the end of this sentence.

::: modules/libpref/init/all.js:575
(Diff revision 2)
> +// Use to control the default setting layout of doorhanger.
> +// 0 = [Allow], [Remember this decision] unchecked
> +// 1 = [Don’t Allow], [Remember this decision] unchecked
> +// 2 = [Allow], [Remember this decision] checked
> +// 3 = [Don’t Allow], [Remember this decision] checked
> +pref("media.autoplay.prompt-layout", 2);

This pref is for code that lives in browser/ so it should be in browser/app/profile/firefox.js rather than in modules/libpref
Attachment #8995377 - Flags: review?(florian) → review-
(In reply to Florian Quèze [:florian] from comment #4)
> Comment on attachment 8995377 [details]
> Bug 1478875 - add different default layout for autoplay prompt.
> 
> https://reviewboard.mozilla.org/r/259832/#review267292
> 
> I see Johann suggested using a WebExtension Experiment in comment 4

I meant bug 1475099 comment 4.
Rank: 15
Priority: -- → P2
Thank for your suggestion!
This issue was fixed in my experiments code by overriding the methods in AutoplayPermissionPrompt's prototype.

Fixed here : https://github.com/alastor0325/autoplay-shield-study/commit/b53401a1fb5647a0157ac2371929533c417d6657
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Attachment #8995377 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: