Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Notify users when autoplay has been blocked and provide option to allow it #8751

Merged
merged 1 commit into from
May 9, 2017

Conversation

darkdh
Copy link
Member

@darkdh darkdh commented May 8, 2017

Display "Block autoplay" in bravey shield

Fix #8738
Address #8739

Auditors: @bbondy, @bsclifton, @jonathansampson

Test Plan:
Covered by automatic test

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

screen shot 2017-05-07 at 9 57 12 pm

@darkdh darkdh added this to the 0.15.3 milestone May 8, 2017
@darkdh darkdh self-assigned this May 8, 2017
Copy link
Collaborator

@jonathansampson jonathansampson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks really good, one question I have though is regarding the wording used in the notification:

"Media autoplay on has been blocked. Do you want to allow it?"

Contrast that with requests for full screen, location, or media capture:

"Allow to use fullscreen mode?"
"Allow to see your location?"
"Allow to use your camera and/or mic?"

I think we should adopt the same pattern:

"Allow to autoplay media?"

@darkdh
Copy link
Member Author

darkdh commented May 8, 2017

fixed in b8fc59c

Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing on YT, video kept loading until I decided what to do with notification. Deciding to disable autoplay, loading persists and pause button is shown rather than play button. Seems like video is not fully loaded and I had to click twice on the pause button to get it working. I felt confused by that.

Regarding UX the best scenario I can think of is having video stopped (play indicator visible) with video placeholder showing instead of forever loading until user decide what to do with notification.

Those are just my thoughts and my guess is that the above is beyond the scope of this PR and it's a great thing to have as-is, so LGTM

@luixxiul luixxiul mentioned this pull request May 9, 2017
4 tasks
@luixxiul
Copy link
Contributor

luixxiul commented May 9, 2017

@darkdh I changed #8739 into a tracking issue, so would you mind removing Fix #8739 from your commit message? thanks!

…ow it

Display "Block autoplay" in bravey shield

Fix #8738

Auditors: @bbondy, @bsclifton, @jonathansampson

Test Plan:
Covered by automatic test
@darkdh
Copy link
Member Author

darkdh commented May 9, 2017

ok, done

*/
autoplayBlocked: function (location, tabId) {
AppDispatcher.dispatch({
actionType: appConstants.APP_AUTOPLAY_BLOCKED,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not blocking merging, but why is location needed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just mean that the browser process already has this info so it is not needed to send from the window renderer. Pls do for a follow up but not high priority.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically it just leaves the chance that someone will use the API wrongly at some point, so better not to include it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

@bbondy
Copy link
Member

bbondy commented May 9, 2017

++

@bbondy bbondy merged commit a3dd46f into master May 9, 2017
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments left; changes look good 😄

if (tabId) {
const tab = webContents.fromTabID(tabId)
if (tab && !tab.isDestroyed()) {
return tab.reload()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is being returned here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do a follow-up along with

return tab.reload()

autoplay: {
enabled: false
noAutoplay: {
enabled: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per our discussions, we want to default this to false, right? So that content isn't blocked
cc: @bradleyrichter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the default is false, the notification won't popup in most of the cases because https://github.com/brave/browser-laptop/pull/8751/files#diff-d4f09c262fdb2f86d8f7407afb926c8eR21
The only case it will show up is users toggle global autoplay to block and without site setting of autoplay to the website

The setting is similar to our default fullscreen setting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the understanding we were defaulting to on with notification bar.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake- I think I missed part of the convo 😄 ++

@bsclifton bsclifton deleted the 8738 branch May 9, 2017 18:54
darkdh added a commit that referenced this pull request May 9, 2017
bsclifton pushed a commit that referenced this pull request May 10, 2017
bsclifton pushed a commit that referenced this pull request May 10, 2017
kspearrin pushed a commit to kspearrin/browser-laptop that referenced this pull request May 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants