Giter Club home page Giter Club logo

watchparty's Introduction

WatchParty

screenshot

An website for watching videos together.

Description

  • Synchronizes the video being watched with the current room
  • Plays, pauses, and seeks are synced to all watchers
  • Supports:
    • Screen sharing (full screen, browser tab or application)
    • Launch a shared virtual browser in the cloud (similar to rabb.it)
    • Stream-your-own-file
    • Video files on the Internet (anything accessible via HTTP)
    • YouTube videos
    • Magnet links (via WebTorrent)
    • .m3u8 streams (HLS)
  • Create separate rooms for users on demand
  • Text chat
  • Video chat

Quick Start

  • Clone this repo via git clone [email protected]:howardchung/watchparty.git
  • Install npm dependencies for the project via npm install
  • Start the server via npm run dev
    • Defaults to port 8080, customize with PORT env var
    • Set SSL_KEY_FILE and SSL_CRT_FILE for HTTPS.
  • Start the React application in a separate shell and port via npm run react
    • Point to server using VITE_SERVER_HOST env var if you customized it above
    • Set SSL_KEY_FILE and SSL_CRT_FILE for HTTPS.
    • HTTPS is required by the browser for some WebRTC features (camera, etc.)
  • Duplicate the .env.example file
  • Rename it to .env
  • Add config for the features you want as described in the advanced setup

Advanced Setup (optional)

All of these are optional and the application should work without them. Some functionality may be missing.

YouTube API (video search)

This project uses the YouTube API for video search, which requires an API key. You can get one from Google here.

Without an API key you won't be able to search for videos via the searchbox.

After creating a YouTube Data API V3 access, you can create an API key which you can add to your environment variables by copying the .env.example, renaming it to .env and adding the key to the YOUTUBE_API_KEY variable.

After that restart your server to enable the YouTube API access on your server.

Firebase Config (user authentication)

This project uses Firebase for authentication. This is used for user login, account management, subscriptions, and handling some features like room locking/permanence.

To set up, create a new Firebase app (or reuse an old one) from here. After creating an application, click on the settings cog icon in the left menu next to "Project overview" and click on project settings. From there, scroll down, create a web application and copy the Firebase SDK configuration snippet JSON data.

Next, you have to stringify it: JSON.stringify(PASTE_CONFIG_HERE) in your browser console, then add it to VITE_FIREBASE_CONFIG in your .env file.

For server verification of accounts you'll also need FIREBASE_ADMIN_SDK_CONFIG, which you should do the same steps for.

Virtual Browser Setup

This project supports creating virtual browsers (using https://github.com/m1k1o/neko) either on a cloud provider or with Docker containers. For development, Docker is easiest.

  • Install Docker: curl -fsSL https://get.docker.com | sh
  • Make sure you have an SSH key pair set up on the server (id_rsa in ~/.ssh directory), if not, use ssh-keygen.
  • Configure DOCKER_VM_HOST_SSH_USER if root is not the correct user
  • Note: If your web client is not running on the same physical machine as the server, you will also need to configure DOCKER_VM_HOST to a publically-resolvable value (i.e. not localhost)
  • If you want to run managed instance pools (whether on cloud or with Docker), configure VM_MANAGER_CONFIG and run the vmWorker service.

Room Persistence

  • Configure Postgres by adding DATABASE_URL to your .env file and then setting up the database schema
  • This allows rooms to persist between server restarts

Tech

  • React
  • TypeScript
  • Node.js
  • Redis
  • PostgreSQL
  • Docker

watchparty's People

Contributors

argn0 avatar bdbch avatar blesson3 avatar dependabot-preview[bot] avatar dependabot[bot] avatar howardchung avatar jawnb avatar rapythereaper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

watchparty's Issues

ESLint

Hi. First of all I'd like to say this project looks very interesting! I was taking a look at the package.json file and I saw there's a config for ESLint but the dependency isn't included. I also took a look at the change proposal for running prettier only on staged files #15 and #16.

How about using ESLint as well for a more complete code style enforcement? You can add prettier as a plugin for ESLint and add a pre-commit hook for ESLint on only staged files with lint-staged.

Disable a room when no one is in it

Right now a room will continue "existing" and the interval keeps running. I think when all users left from the room roster, the room could be set to "cold" which stops the interval and pauses the videos but keeps it open.

What do you think @howardchung ?

stopping a vbrowser during assignment doesn't cancel it

Currently, if the buffer pool is exhausted and a brand new VM needs to be provisioned, it can take 1-2 minutes for the VM to be assigned. If the user cancels by hitting stop, the assignment isn't cancelled and the vbrowser will start when it's ready, even if the user is doing something else.

Make a homepage for app

Currently the homepage hosts a default room, but probably want to make a splash/landing page to showcase the features (and also avoid people putting objectionable content up)

lint-staged fails when editing unsupported prettier file

Apparently this won't work if a non-supported file is passed to prettier.

We can either whitelist extensions (as in the original change), just run on everything (might be ok), or turn off running prettier on commit. I'm not super opposed to just running it with npm run prettier when we want to do a formatting pass.

combobox sometimes doesn't select

Noticed an issue with the combobox where picking a result sometimes doesn't trigger a video change. Haven't been able to repro it reliably, but will update if I can

Add playlist feature

I think just being capped to one video at a time is bad when you find another video but don't want to interupt the current video.

handle non-video URLs pasted into app

Currently the app assumes that URLs will be for media files, but currently if you paste a link that's not a video it'll just fail to load.

Possible solutions:

  • Show the user a message indicating that maybe they want to launch a VBrowser
  • Show the website in an iframe (will not sync between room members)

React Native mobile app

Bit a longer-term goal, but it should be possible to build a RN app that talks to the same API and has better mobile support.

Packaging the existing app as a PWA is also an option, but that's probably Android-only and PWAs don't seem to have taken off.

README improvements

I think having better instructions on how to setup the project helps the repo to get traction and is helpful specially for beginners.

What do you think @howardchung?

protobowl.com integration?

You might have a better system already, but have you thought about possibly integrating with protobowl.com? It has a system for generating/joining rooms, as well as a ton of questions from quizbowl-type competitions.

I don't know enough to know how easy it would be, so feel free to discard. The Github is here.

Discord Server?

Should we have a Discord server for this project for faster iterations?

LXD/LXC container?

I saw the recommendation of a Docker deployment, but I'd like to suggest LXD/LXC as a possibility. Has all of the advantages of a Docker situation, but minus the "random layers" issues Docker can bring to the table.

If it sounds like something interesting, I might be willing to pitch in and help develop the image :)

vbrowser controls are lost on server restart

This is currently due to the fact that the server tracks the controller by their socket.io ID and this is reset when the server restarts and all clients reconnect.

We either need to use a different ID value or provide some method of mapping to the old value.

I've achieved this previously by having each client store their socket.io id in localStorage and providing a reconnect socket command that transfers state over to the new ID. Works if we can trust room members.

Fullscreen controls

When you go fullscreen, you lose the ability to use any of the video player's controls. Being able to pause, skip forward and change the volume whilst fullscreen would be very useful.

Allow streaming a subtitle file along with video file when filesharing

Multiple people have asked for this.

Probably we'd need to:

  • Create a modal interface for picking video and subtitle (not just direct to file picker like it is now)
  • Send the srt file over a separate RTCPeerConnection
  • Convert srt to vtt on all clients
  • Add vtt as track on the video

Users can't join a screen/fileshare/videochat after server restart

Normally, we end the session (reset host to '') when the screensharer disconnects. However, if the server gets restarted (code update, etc.) it's not clear what the current behavior is. It's possible the room might end up in a locked state where the video can't be updated as the name of the streamer is no longer valid.

Explore using mediasoup for screenshare/fileshare

Currently, screenshare/fileshare require one user to upload to everyone else in the room, which doesn't scale to large room sizes.

To achieve higher viewer counts, we can try something like MediaSoup which provides a server that will broadcast a single user's video stream to everyone else over WebRTC.

add customization to vbrowser image

Including:

  • Extension list (currently, ublock Origin and NordVPN)
  • Custom home page (currently google.com homepage, sometimes shows captcha)

document createRoom API

For allowing integrations to create/launch rooms with specific videos set.

We already have a createRoom endpoint, although it currently doesn't auto-set a video.

Docker

Docker might be worth exploring for the benefits it brings in quick setup and portability. Maybe not force the project to use docker but have the option available. I find it's particularly helpful for setting up databases like postgres in a quick and simple manner.

Possible premium/subscriber features

The virtual browsers do cost something to run, so ideas for features we can offer to subscribers:

  • Longer time before auto-shutdown (currently VMs are unassigned from rooms after 6 hours, could make this e.g. 12 hours vs 3)
  • Offer higher-resolution (1080p vs 720p)
  • Faster instances for subscribers (might be linked to the above)

Allow logged in users to create persistent rooms

First of great project @howardchung! I'm a user of cytube right now and me and my friends enjoy watching videos from then to then.

Biggest issue is switching between Cytube and Discord when we want to watch non-youtube content together and I think the vBrowser solution is great!

I think having the option to create 1 persistent room which can be password or whitelist protected would be an awesome feature (and possibly could be a premium feature for more than one room).

What are your thoughts on this?

reobtain controls on vbrowser reconnect

Currently if the vbrowser connection is lost and the user is controlling, the client will reconnect but won't try to re-obtain the controls. Fix is to refresh, but we should make this better.

host roles and locking

Allow logged in users to designate certain users as "hosts" (default to themselves) and lock the room so no one else can change things.

This will be needed for larger rooms.

No audio with vbrowser in Safari (macos)

Apparently VP8+Opus won't work, so maybe test out H264 + Opus, or wait for Safari to catch up to the rest. Not sure how much demand there is for it to work on Safari.

provide UI for setting custom media sources

Currently this can be done by configuring REACT_APP_MEDIA_PATH, or by changing the setting in localstorage (settings dialog not enabled atm)

We should probably make this a room property so that all members have a consistent view of the media source.

Supported sources now are s3 buckets, GitLab repos, and nginx file servers. Plex media servers would probably be good to add as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.