m1k1o / neko

A self hosted virtual browser that runs in docker and uses WebRTC.
https://neko.m1k1o.net/
Apache License 2.0
5.96k stars 449 forks source link

Improvements allowing cast to embedded touch screen device #261

Closed urbanekpj closed 1 year ago

urbanekpj commented 1 year ago

Hi. i try using neko in specific configuration: i'm trying cast video to separate embedded device with touch screen with implicit control and ?cast=true. I have some issues to discuss.

  1. ?cast=true don't hide overlay buttons, eg full screen. i assume that if cast flag is enabled and implicit control is set then all buttons can be hidden. i handle full screen on browser level(--kiosk mode). it easy to fix this but maybe im missing some use case.

  2. i disabled security option for requiring user interaction for playing audio on browser level. if cast option is set i don't mute audio, but then when security option is enabled then no video is started so i changed video.play() to retry with mute if cast is set

        try {
          await this._video.play()
        } catch (err: any) {
            try {
              this.$accessor.video.setMuted(true)
              this._video.muted = true
              await this._video.play()
            } catch (err: any) {
              this.$accessor.video.pause()
            }
        }
  3. on my touch device i can't 'drag' (eg. select text). i added onTouch events to onMouse events and it is working now. but im not sure if it is relay not working or it should work but my setup is broken. i did not test mobile devices.

  4. i also consider option to disable audio at all on client side. stat muted but also don't show muteOverlay, audio will be played on different device.

for first 3 items i have code ready so i can provide PR but first i want some comments if this have any sense and can be include it in main repo.

can anyone share your thoughts?

m1k1o commented 1 year ago

Hi, for the first point, it was originally without those controls. Just recently they have been added. So there seems to be multiple usecases that are trying to fit under ?cast=1 feature.

  1. Hiding everything and showing only video (original usecase).
  2. Hiding GUI, only showing video but still providing control settings (to take control and go fullscreen, clipboard on unsupported browsers).

We could revert the usecase for ?cast=1 to be again, video only. And add new ?embed=1 when someone wants to embed neko. That would mean all controls would be collaped but they still could be accessed. That sould split both usecases.

For the point 2, that could be generally used in all cases. If the browsers support it.

3, we don't have touch support yet. Thanks for adding it!

For the point 4, there could be rather more generic flags that can be passed down in URL e.g. ?flags=disable_audio.

urbanekpj commented 1 year ago

i submitted PR based on your comment.

  1. add embed mode and cast mode,
  2. autoplay with audio if possible, then fallback to muted, then fallback to paused
  3. i added disable_audio=1 i don't know what good practice is for flags in url query.

if more changes are needed please let me know.

m1k1o commented 1 year ago

Thank you very much. It looks good. I'll review and test this tomorrow evening.

m1k1o commented 1 year ago

@urbanekpj I merged two PRs. And there are some missing points for the remaining two PRs.

  1. disable_audio shoud actually disable audio, or we rename it to muted or voulme=<number>
  2. touch events use deprecated function and according to stack overflow should use { passive: false } attribute.
urbanekpj commented 1 year ago

Hi i have other issue with reconnecting after server restart.
if url with user password was provided i expect that client will auto login without login form.

see https://github.com/m1k1o/neko/pull/268 for proposed changes and discussion

m1k1o commented 1 year ago

So i think this can be closed as other PRs have been merged.