A native desktop client app for BareRTC #34

Open
opened 2023-08-21 03:39:52 +00:00 by kirsle · 0 comments

It could be a fun idea to build a native desktop application for BareRTC targeting Windows, macOS and Linux (and possibly even Android or iOS). This would be very much a nice to have feature and it probably won't happen unless enough stars align just right to make it sound feasible. But it could be a lot of fun to program if it is feasible!

The ideal stack

Ideally it should be:

  • Written in Go.
  • Using the Fyne UI toolkit or similar.
  • Able to access webcams in a cross-platform way across Linux, macOS and Windows (e.g. using the Video4Linux API or ad-hoc libraries on a per platform basis is off the table)

Things that could make this possible

  • We already have a Go client library for BareRTC now thanks to the built-in chatbot program (BareBot), so a desktop app written in Go could interact with the WebSockets server and log on.
  • There seems to be a WebRTC library for Go which can handle the WebRTC video sharing protocol on the chat room.
    • It has example scripts how you can stream a local video file on disk as your webcam, or to download frames from another user's webcam and save that to disk, etc.
    • They have 3rd party library examples using things like GStreamer to connect your webcam on Linux to a WebRTC call.
  • A cross platform way to get your webcam from a Go program.
    • There is a GStreamer library for Go which seems to build for macOS and Windows as well, but it's not sure yet whether it can open webcams on non-Linux systems.
    • I found a Fyne webcam widget somebody made that uses an OpenCV library for Go to access cameras in a cross-platform way. The widget sounds in a rough state with many caveats but might be an interesting avenue to explore.
  • BareRTC would need to build a nice self-contained authentication workflow to enable a desktop app to be independent and stand-alone (only dealing with BareRTC and not needing to know about your website).
    • Example workflow could be: user opens the desktop app for the first time, enters the domain name of the BareRTC server (chat.example.com), and a web browser is opened to an OAuth style handshake with that server.
    • Example: BareRTC redirects the page to your website to log in with username/password and bounce them back to BareRTC, which then gives them a login token they can store locally to re-authenticate again in the future.
    • Avoids the client app needing to store the user's password or know anything about your custom website, if BareRTC can proxy auth requests in a unified way.

Why not just make it an Electron app?

The easiest solution would be to just build an Electron app where it's basically a Chromium browser that wraps around a web app. Then the existing front-end for BareRTC could be easily embedded into it, Electron is cross-platform already, it supports webcams and WebRTC already and would take very little work to get going.

But what's even easier is: if a user wants a "desktop app" for BareRTC they can simply "install web page to desktop" in a Chrome browser which gets them 99% of the way to what an Electron app would provide, and that would require zero work at all.

It could be a fun idea to build a native desktop application for BareRTC targeting Windows, macOS and Linux (and possibly even Android or iOS). This would be very much a **nice to have** feature and it probably won't happen unless enough stars align just right to make it sound feasible. But it could be a lot of fun to program if it _is_ feasible! ## The ideal stack Ideally it should be: * Written in Go. * Using the [Fyne UI](https://fyne.io) toolkit or similar. * Able to access webcams in a cross-platform way across Linux, macOS and Windows (e.g. using the Video4Linux API or ad-hoc libraries on a per platform basis is off the table) ## Things that could make this possible * [x] We already have a Go client library for BareRTC now thanks to the built-in chatbot program (BareBot), so a desktop app written in Go could interact with the WebSockets server and log on. * [x] There seems to be a [WebRTC library for Go](https://github.com/pion/webrtc) which can handle the WebRTC video sharing protocol on the chat room. * It has example scripts how you can stream a local video file on disk as your webcam, or to download frames from another user's webcam and save that to disk, etc. * They have [3rd party library examples](https://github.com/pion/example-webrtc-applications) using things like GStreamer to connect your webcam on Linux to a WebRTC call. * [ ] A cross platform way to get your webcam from a Go program. * There is a [GStreamer library for Go](https://github.com/tinyzimmer/go-gst) which seems to build for macOS and Windows as well, but it's not sure yet whether it can open webcams on non-Linux systems. * I found a [Fyne webcam widget](https://git.martyn.berlin/martyn/fyne-widgets) somebody made that uses an [OpenCV library for Go](https://gocv.io/) to access cameras in a cross-platform way. The widget sounds in a rough state with many caveats but might be an interesting avenue to explore. * [ ] BareRTC would need to build a nice self-contained authentication workflow to enable a desktop app to be independent and stand-alone (only dealing with BareRTC and not needing to know about your website). * Example workflow could be: user opens the desktop app for the first time, enters the domain name of the BareRTC server (`chat.example.com`), and a web browser is opened to an OAuth style handshake with that server. * Example: BareRTC redirects the page to your website to log in with username/password and bounce them back to BareRTC, which then gives them a login token they can store locally to re-authenticate again in the future. * Avoids the client app needing to store the user's password or know anything about your custom website, if BareRTC can proxy auth requests in a unified way. ## Why not just make it an Electron app? The _easiest_ solution would be to just build an [Electron app](https://www.electronjs.org/) where it's basically a Chromium browser that wraps around a web app. Then the existing front-end for BareRTC could be easily embedded into it, Electron is cross-platform already, it supports webcams and WebRTC already and would take very little work to get going. But what's even easier is: if a user wants a "desktop app" for BareRTC they can simply "install web page to desktop" in a Chrome browser which gets them 99% of the way to what an Electron app would provide, and that would require _zero work_ at all.
kirsle added the
enhancement
label 2023-08-21 03:39:52 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: apps/BareRTC#34
There is no content yet.