Jump to content

Multi user/player sync, "watch party" utility


lastelement21

Recommended Posts

lastelement21

Currently version 0.1, it works but its rough.   It's meant to be run by an emby server owner, as it requires a server api key.  It essentially reads the room leader's location, jumps room members to 10-ish seconds ahead of the room leader, and finally unpauses roughly in sync.

Tested clients:  iOS, Android, Amazon Fire devices, and the web player.  Also working, but only as a stream or room leader, not as a follower: Chromecast and Roku.  (Supposedly these devices may work as a following player if the server is on the same local network as the player, but I have not tested this)

If any client falls out of sync/halts playback, it resyncs immediately.  You must log out of Emby Sync, or "leave room" to stop syncing.  Sessions offline for more than 10 minutes will automatically stop syncing.  To force a resync, rewind a bit on the out of sync follower.

Emby clients only update the server with status info every second or so, so sync is only possible within a couple seconds in either direction. (Close enough for watching with friends online for sure!)

To try it out: 

Easiest is to just fire up the container and point your browser at http://<containerhost>:5000 and log in using your Emby Connect username. (The Emby password is not stored, it is used against the emby API for auth only)  Sorry, no local only emby accounts or emby email as logins right now.  Only your clients which have been active within the last five minutes will be visible, if you don't see any clients to select, make sure the client is open, logged in, and recently interacted with.

docker run --name emby-sync -e EMBY_SERVER='<emby_url>' -e SECRET_KEY='<emby_server_api_key>' -p 5000:5000 lastelement21/emby-sync:latest

I've set it up in Docker Hub here: https://hub.docker.com/repository/docker/lastelement21/emby-sync

It's on Github here: https://github.com/cameronurnes/emby-sync

Todo:  Local user support, unpause when room leader unpauses instead of waiting/resyncing, test more clients, Chromecast as follower,  adjust session cleanup task, try out using session info from api for unpause during sync instead of timers, consider using stored user access keys instead of API key, better GUI stuff.  I am not a frontend developer, so any help on that would be appreciated.



suCU09k.png

Edited by lastelement21
  • Like 7
Link to comment
Share on other sites

lastelement21
2 hours ago, Garbui85 said:

Hi there, now also tested on AndroidTV. Functional only as ‘Leader’ not follower with Emby app. 

Cheers

Interesting, would have expected that one to work similar to the app.  Thanks for the results!  Hopefully some of these can be made to work eventually.

Link to comment
Share on other sites

chef

Hi, this is cool, and I needed to post here so I get reply notifications.

 

Edited by chef
Link to comment
Share on other sites

Watching topic also - I'm holding out for local user functionality. I just want to be able to play same media throughout the house like Sonos does for video or chromecast audio speaker groups. 

 

Thanks for your work on this. This is something I would be willing to pay for - so hopefully there'll be a donate button somewhere when you are comfortable. 

Link to comment
Share on other sites

lastelement21
26 minutes ago, AxeMan said:

Watching topic also - I'm holding out for local user functionality. I just want to be able to play same media throughout the house like Sonos does for video or chromecast audio speaker groups. 

 

Thanks for your work on this. This is something I would be willing to pay for - so hopefully there'll be a donate button somewhere when you are comfortable. 

Nothing stops you from doing local player syncs with this tool right now, however, it won't ever be within milliseconds because the clients just don't report their location with that accuracy/frequency.

Link to comment
Share on other sites

Garbui85
2 hours ago, AxeMan said:

Watching topic also - I'm holding out for local user functionality. I just want to be able to play same media throughout the house like Sonos does for video or chromecast audio speaker groups. 

 

Thanks for your work on this. This is something I would be willing to pay for - so hopefully there'll be a donate button somewhere when you are comfortable. 

Hey AxeMan this is exactly my use case at the moment working across my players (varying results in leader/follower) works great for local playback. 

Link to comment
Share on other sites

Garbui85
On 31/08/2020 at 23:35, lastelement21 said:

Interesting, would have expected that one to work similar to the app.  Thanks for the results!  Hopefully some of these can be made to work eventually.

I too was surprised, Tv is running Oreo and latest updates to apps. If I can get a LAN cable to it I am interested to see if results vary as it could be a WiFi issue on the tv. Other than chrome browsers all other follower clients have been wifi so i don’t know that it is a signal issue. 

Link to comment
Share on other sites

On 9/4/2020 at 5:07 PM, lastelement21 said:

Nothing stops you from doing local player syncs with this tool right now, however, it won't ever be within milliseconds because the clients just don't report their location with that accuracy/frequency.

I was hoping to not have to use the Emby Connect login. from what I understand, that's required...?

On 9/4/2020 at 6:44 PM, Garbui85 said:

Hey AxeMan this is exactly my use case at the moment working across my players (varying results in leader/follower) works great for local playback. 

Is it all in relative sync? or do you end up with something that sounds kinda like an echo if they are off on the audio by a bit? 

Link to comment
Share on other sites

  • 1 month later...
danlo315

@lastelement21 This is a great idea and I am trying it out.  Maybe need a little pointer here on how to set it up.

Running docker, emby as well as emby sync are reverse proxy'd.  No issues accessing both apps.

image.thumb.png.4e298b17495c931563be33ab9ef63353.png

 

However, the videos are not syncing up.  How do I troubleshoot this?

Link to comment
Share on other sites

lastelement21

Hi danlo315!  Did you set up the API key for sync to send commands to the emby server?  If so, not sure.  I'll test it out today and make sure it still works for me/something didn't change.

Link to comment
Share on other sites

lastelement21
On 9/9/2020 at 6:08 AM, AxeMan said:

I was hoping to not have to use the Emby Connect login. from what I understand, that's required...?

Is it all in relative sync? or do you end up with something that sounds kinda like an echo if they are off on the audio by a bit? 

It can definitely end up with an echo.  The players don't update their location with enough frequency/accuracy to fully and reliably sync to the point of no audio distortion.  It does happen, but my main target with this has been for online watch parties with friends, not for syncing within earshot of each other.  It works OK for that, but is not perfect.

Link to comment
Share on other sites

lastelement21

BTW I have noticed the sync server can get into a weird state.  If something is really broken, please try rebooting the sync server/container.

Link to comment
Share on other sites

lastelement21
23 minutes ago, danlo315 said:

@lastelement21 This is a great idea and I am trying it out.  Maybe need a little pointer here on how to set it up.

Running docker, emby as well as emby sync are reverse proxy'd.  No issues accessing both apps.

image.thumb.png.4e298b17495c931563be33ab9ef63353.png

 

However, the videos are not syncing up.  How do I troubleshoot this?

OK I tested it and it worked fine today, however I did need to reboot my sync container.  If your API key is set up properly and the container is fresh, it should work.

Link to comment
Share on other sites

danlo315
4 minutes ago, lastelement21 said:

Hi danlo315!  Did you set up the API key for sync to send commands to the emby server?  If so, not sure.  I'll test it out today and make sure it still works for me/something didn't change.

Thanks @lastelement21! I just tried using a wrong API key and the app threw an exception, so I think the API key is correct.

Link to comment
Share on other sites

danlo315

Got this in my emby sync container log:

Execution of job "Sync bdfe5a77b1ae152d0e981f5b857d3a95 afff2d3e40a0d42ab1685c92c828119d (trigger: date[2020-10-30 12:36:39 EDT], next run at: 2020-10-30 12:36:39 EDT)" skipped: maximum number of running instances reached (1),
Execution of job "Sync bdfe5a77b1ae152d0e981f5b857d3a95 afff2d3e40a0d42ab1685c92c828119d (trigger: date[2020-10-30 12:36:42 EDT], next run at: 2020-10-30 12:36:42 EDT)" skipped: maximum number of running instances reached (1),
Execution of job "Sync bdfe5a77b1ae152d0e981f5b857d3a95 afff2d3e40a0d42ab1685c92c828119d (trigger: date[2020-10-30 12:36:45 EDT], next run at: 2020-10-30 12:36:45 EDT)" skipped: maximum number of running instances reached (1),
Execution of job "Sync bdfe5a77b1ae152d0e981f5b857d3a95 afff2d3e40a0d42ab1685c92c828119d (trigger: date[2020-10-30 12:36:51 EDT], next run at: 2020-10-30 12:36:51 EDT)" skipped: maximum number of running instances reached (1),
Execution of job "Sync bdfe5a77b1ae152d0e981f5b857d3a95 afff2d3e40a0d42ab1685c92c828119d (trigger: date[2020-10-30 12:36:54 EDT], next run at: 2020-10-30 12:36:54 EDT)" skipped: maximum number of running instances reached (1),
Execution of job "Sync bdfe5a77b1ae152d0e981f5b857d3a95 afff2d3e40a0d42ab1685c92c828119d (trigger: date[2020-10-30 12:36:57 EDT], next run at: 2020-10-30 12:36:57 EDT)" skipped: maximum number of running instances reached (1),

 

Edited by danlo315
Link to comment
Share on other sites

lastelement21

So, looks like its sending the sync commands.  That error only means that the task is already trying to run.  Should be able to sync chrome web player.  Did you restart the container?  Can you provide any more info which might help replicate the issue?

Link to comment
Share on other sites

danlo315
21 hours ago, lastelement21 said:

So, looks like its sending the sync commands.  That error only means that the task is already trying to run.  Should be able to sync chrome web player.  Did you restart the container?  Can you provide any more info which might help replicate the issue?

I restarted emby sync and emby containers - same issue.  As soon as I have more than one player joined in a room, the error message shows up.  Once a player leaves the room and only the leader is left, the error goes away.  I tried using multiple users as well as single user logged in multiple devices.  Would love to help but need some pointers on providing debugging info.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
Nicias

I've tried to get this working, I keep getting this error when I log in:

 

Value cannot be null.
Parameter name: appName
192.168.98.8 - - [31/Jan/2021:19:41:04 +0000] "POST /login HTTP/1.1" 302 219 "http://192.168.98.2:5000/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.98.8 - - [31/Jan/2021:19:41:04 +0000] "GET /login HTTP/1.1" 200 2783 "http://192.168.98.2:5000/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0"

What am I doing wrong?

Link to comment
Share on other sites

lastelement21
On 12/27/2020 at 4:05 AM, GiGo said:

This would be great, but how come a Docker container and not just a simple plugin?

Mostly because I don't have the time to learn how to make a plugin for emby, so I did it with python/docker because I know those better.  One of the devs reached out to ask if it was OK to use this idea built into the server or as a plugin and I said YES.  It would be wonderful to have this built in, rather than as a sidecar.  The current setup is hacky, but it was a fun weekend project so that was OK for me.  It's mostly meant as a proof of concept for this sync method.

Edited by lastelement21
  • Like 2
Link to comment
Share on other sites

lastelement21
On 9/4/2020 at 1:39 PM, AxeMan said:

Watching topic also - I'm holding out for local user functionality. I just want to be able to play same media throughout the house like Sonos does for video or chromecast audio speaker groups. 

 

Thanks for your work on this. This is something I would be willing to pay for - so hopefully there'll be a donate button somewhere when you are comfortable. 

It works locally, just may not be in sync enough if you are trying for PERFECT sync.  For wandering between rooms its good enough.  As far as I know apart from receivers with multiple HDMI outputs, or HDMI splitters (again with physical connection), nobody does perfect (sub 10ms) video sync.  Not even AppleTV.

Link to comment
Share on other sites

AxeMan

 

On 2/1/2021 at 5:08 PM, lastelement21 said:

It works locally, just may not be in sync enough if you are trying for PERFECT sync.  For wandering between rooms its good enough.  As far as I know apart from receivers with multiple HDMI outputs, or HDMI splitters (again with physical connection), nobody does perfect (sub 10ms) video sync.  Not even AppleTV.

Thanks - do you mean to say that we can login using local emby clients? Your OP indicated that was not the case. I've thought about running hard wiring, but too much work.

 

I think for the most part, i'd be okay with a slight delay. probably just have to keep the volumes at a point where one room doesn't hear the other room, so you don't hear echo (echo echo)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...