Hacker News new | ask | show | jobs
by Aaargh20318 3215 days ago
> There's a broader question about a user's will and the sites intent especially when it comes to business plans of the site

The site's business plans are not my problem. Basically, my phone and my computer should do what I want. Why is there even an API to make a video player enter/exit full-screen mode ? That's 100% a user decision and there is no valid reason why that should ever be exposed to JS.

2 comments

>Why is there even an API to make a video player enter/exit full-screen mode ? That's 100% a user decision and there is no valid reason why that should ever be exposed to JS.

There absolutely are valid reasons and responsible uses for the browser to expose that API. Instead the argument should be around the irresponsible uses justifying hiding that part of the API.

Valid reasons to expose full-screen to the API:

* An "Always full-screen videos when I play them" button. * Remote control of demo displays, kiosks, etc. Force them to all fullscreen and play a video synced up. * Disable unnecessary features when website is full screen (e.g. stop polling website for changes) * Exit full-screen on certain conditions. For example on a shared streaming site like Rabb.it, maybe if someone joins your chat room (assume this is configurable by the user)

In short, you can use JS to respectfully enact user decisions.

I'll also mention a related case. On Safari iOS, you can't autoplay a <video> element unless the user has interacted with it via tapping it. The goal, obviously, is to stop autoplaying videos. The goal, of stopping annoying autoplaying videos, is noble, but at the cost of removing the possibility of responsible usage. Maybe it's worth it, maybe it's not, but there is an undeniable tradeoff.

There is a long history of browsers disabling or crippling features because they get abused by web pages. In fact is is almost a rule that if a feature can be abused, it will be abused.

A possible solution is having a "responsible app mode" in browsers. Whitelisted webpages have full access to these privileged APIs which would otherwise be stubbed out and non-functional (hopefully in a way that a webpage can't detect).

What if I want to present an X button that the user can click to exit fullscreen? How would I do that without a programmable API?
That should be a browser option. (Show exit full-screen button or not.)

Also, especially for video, the browser should be able to play it full screen without any distractions.

Of course, there are optional enhancements (subtitles, or different audio tracks) driven via JS. And for those the controls have to go somewhere.

Ideally, if there were a standard for those, the browser could handle it. (But then we're at the problem of an ever bloating browser.)

Sounds like you are advocating for something very different than the current APIs. You're asking that the browser define its own UI for an exit button. How does it know where to put that? What if it is a game in a `<canvas>` element and the button overlays some important UI in the game?

I think you're overreacting to one bad-actor. Inevitably your suggestion here leads to good-actor pages having much less power to present good UI to its users. The browser has to think of all use-cases and have options for that, rather than defining lower-level hooks that pages can do what they want with.

Would it make you feel better that there already many other ways that pages can do user-hostile things? Have you ever visited a page that blocks right-click? Would you want to forbid Mouse Events because of this?

I like the trust model that current browsers do. If I trust a page they can use the full viewport or screen, and a lot of keys, etc.

> You're asking that the browser define its own UI for an exit button.

Yes. Currently firefox puts a "to exit full screen press esc" OSD already on videos, that also interferes with visual presentation of sites/directors. So ... directors already don't put shit there.

The same thing goes for walled gardens (like Apple's - they don't allow some things), the problem is not that it's curated, the problem is that there are insufficient tools available for users to put their walls where they want.

Yes, by default I don't want to allow blocking right click. (You might be familiar with the saga of this bug https://bugzilla.mozilla.org/show_bug.cgi?id=78414 . )

> ave you ever visited a page that blocks right-click? Would you want to forbid Mouse Events because of this?

No, the left mouse button is for interaction with the webpage, the right mouse button is mine. Just don't send any events for the right mouse button.

Why not just restrict it to user-initiated events that can exit or enter full screen? Similar to how you have to press a button to enter full screen mode. It seems to make sense to do the same thing to exit, or other various actions.
There already is one as part of the video player component, at least on iOS, right next to the button that toggles full-screen.
The fullscreen API is not just for video elements.