Jump to content

Multi user/player sync, "watch party" utility


lastelement21

Recommended Posts

Hi Lastelement,

  my emby server runs as a jail/plugin in TrueNAS and there isn't native support for docker.  Is there a way in which I can manually install this?

thanks

Paul

Link to comment
Share on other sites

lastelement21
2 hours ago, csjjpm said:

Hi Lastelement,

  my emby server runs as a jail/plugin in TrueNAS and there isn't native support for docker.  Is there a way in which I can manually install this?

thanks

Paul

Sure!  Its just a python flask app, if you read through the Dockerfile etc, you can see what it does exactly to set up the environment, and which commands it runs.

Other option is to have a VM hosting docker in your TrueNAS.  There also isnt any particular requirement to run this in the same jail as emby I think, I thought TrueNAS could get docker put in.

Good luck!

https://github.com/cameronurnes/emby-sync

Edited by lastelement21
Link to comment
Share on other sites

On 20/02/2021 at 17:02, lastelement21 said:

Sure!  Its just a python flask app, if you read through the Dockerfile etc, you can see what it does exactly to set up the environment, and which commands it runs.

Other option is to have a VM hosting docker in your TrueNAS.  There also isnt any particular requirement to run this in the same jail as emby I think, I thought TrueNAS could get docker put in.

Good luck!

https://github.com/cameronurnes/emby-sync

Thanks for replying.  No docker isn't properly supported yet you have to install a VM to run docker and I haven't had any luck getting one of those working.

 

I'll have to polish up on my BSD skills to understand flask apps 🙂  I can see the commands copying, making and running stuff.  So if I made a separate jail and set this up then I can reference my existing emby server from this separate emby-sync server?

Link to comment
Share on other sites

lastelement21
1 hour ago, csjjpm said:

Thanks for replying.  No docker isn't properly supported yet you have to install a VM to run docker and I haven't had any luck getting one of those working.

 

I'll have to polish up on my BSD skills to understand flask apps 🙂  I can see the commands copying, making and running stuff.  So if I made a separate jail and set this up then I can reference my existing emby server from this separate emby-sync server?

Yes, its just a running python app.  All communication with the server is via TCP/IP so it can run anywhere as long as it can reach the API of the server, and your browser can reach the web interface of emby-sync.

Link to comment
Share on other sites

danlo315

So I decided to take another stab at getting this up and running for me.  Turns out that my reverse proxy conf was faulty on websockets and I could not control other players.  This is now fixed on my end.

One question I have: If I simply login as myself, I don't see players associated with other logins even though I am an admin.  This looks like for every user that wants to participate in the watch party needs to log into this tool and join the party.  Is this correct?  Would there be a way to see all players when an admin is logged in and then control the join/leave room and pick the leader centrally?

 

Link to comment
Share on other sites

lastelement21
5 hours ago, danlo315 said:

So I decided to take another stab at getting this up and running for me.  Turns out that my reverse proxy conf was faulty on websockets and I could not control other players.  This is now fixed on my end.

One question I have: If I simply login as myself, I don't see players associated with other logins even though I am an admin.  This looks like for every user that wants to participate in the watch party needs to log into this tool and join the party.  Is this correct?  Would there be a way to see all players when an admin is logged in and then control the join/leave room and pick the leader centrally?

 

Yes, it looks like the emby API exposes this information in the getUsersById endpoint, under Policy, as a boolean "IsAdministrator".   I do not currently parse this information and I don't have the time to work on it urgently, but it shouldn't be terribly hard to add.

Link to comment
Share on other sites

I've got an Ubuntu VM on my TrueNAS to get a Jitsi server going, l have to try and avoid breaking it, and see if I can get this docker installed 🙂

Link to comment
Share on other sites

  • 6 months later...
jspanitz
On 8/31/2020 at 1:30 AM, lastelement21 said:

Currently version 0.1

Have there been any updates to this or is it still under development - was about to give it a try and figured I'd check first.

Link to comment
Share on other sites

lastelement21
15 hours ago, jspanitz said:

Have there been any updates to this or is it still under development - was about to give it a try and figured I'd check first.

I recently pulled in a variety of improvements from a fork, should still work etc

Link to comment
Share on other sites

  • 3 weeks later...
lastelement21

I ended up reverting that other guy's changes.  He left it in a super broken state, unfortunately.  Better off with the old build which actually runs.  Will see about adding some functions myself.

Edited by lastelement21
Link to comment
Share on other sites

I've added two PRs to the code. Dark theme for nicer viewing and some slight improvements to the main play/seek functionality.

On my own machine, with one client connecting over a VPN, I could easily get sub second synchronization.

The main issue I've found is that Emby players sometimes don't want to seek/play correctly, mostly seeming to be a FireFox issue, but I didn't see anything in the F12 logs.

Additionally I think the user/username/embyconnect name can cause some inconsistencies in the database.

 

Link to comment
Share on other sites

lastelement21
8 hours ago, Sidiox1 said:

I've added two PRs to the code. Dark theme for nicer viewing and some slight improvements to the main play/seek functionality.

On my own machine, with one client connecting over a VPN, I could easily get sub second synchronization.

The main issue I've found is that Emby players sometimes don't want to seek/play correctly, mostly seeming to be a FireFox issue, but I didn't see anything in the F12 logs.

Additionally I think the user/username/embyconnect name can cause some inconsistencies in the database.

 

Does the PR still allow login in with the emby connect username?  I literally always just have my users use that login vs the local username.

Link to comment
Share on other sites

lastelement21
2 hours ago, STR8 said:

Was wondering if this will work with or in the nvidia shield, roku, apple tv apps etc... or just with a web browser?

They should all be able to lead.  You'll need to test if they can follow, some players ignore the commands.  It definitely allows the android app to follow, so the others might work.

Link to comment
Share on other sites

7 hours ago, lastelement21 said:

Does the PR still allow login in with the emby connect username?  I literally always just have my users use that login vs the local username.

My PR actually aims to fix what went wrong. Specifically see commit.

What you initially had was:

def update_or_create_account(response):
  	...
	newuser = User(emby_id=response['User']['Id'], username=response['User']['ConnectUserName'].lower())
    ...

But that means there must be a ConnectUserName and that means that when querying on username, you must use the connectname, even when logging in with the emby name.

(As both are equally valid from an Emby point of view)

That was going wrong here:

@app.route('/login', methods=['GET', 'POST'])
def login():
  	...
	user = User.query.filter_by(username=form.username.data.lower()).first()

The form.username doesn't have to be the same as the ConnectUserName and could cause issues (and did cause issues for me).

 

In my PR, no manual queries to the Users are done, but the login procedure returns the correct user based on the actual login process.

def check_password(username, password) -> Tuple[bool, Union[User, None]]:
	...
	new, user = update_or_create_account(response_json)
	...
	return user

The returned user is then used in the login route:

@app.route('/login', methods=['GET', 'POST'])
def login():
  	...
	if form.validate_on_submit():
      	# Correct user returned from the password check:
        authenticated, user = check_password(form.username.data, form.password.data)
        if not authenticated:
            flash('Invalid username or password')
            return redirect(url_for('login'))
    ...

 

Link to comment
Share on other sites

  • 1 month later...
Eremitak

Hi, I can synchronize my devices both locally and remotely (4g) (strangely even after having logged them out) but any of my friends do not appear in the list (from cell, from my webui ip from app.emby.media etc.).
I have updated the users on my server with their connect and they use the same names. Clarifications?
Thanks in advance.

Link to comment
Share on other sites

Eremitak
11 hours ago, Eremitak said:

Hi, I can synchronize my devices both locally and remotely (4g) (strangely even after having logged them out) but any of my friends do not appear in the list (from cell, from my webui ip from app.emby.media etc.).
I have updated the users on my server with their connect and they use the same names. Clarifications?
Thanks in advance.

After several attempts, we were able to understand that the system is spartan (you could have written it 🤬).
Each user must access this "Emby sync" that I host with their accounts (connect) and from there, enter the room.
(it wasn't hard to write this ******* line).
 

1) they only see themselves (we wasted a day figuring out why the **** I was the only one in the room ... 🤬);

2) You have forced the 5000/tcp and there is no **** that it takes, remotely it is inaccessible (I have 7 containers, servers for various games, plex, emby, iis etc. go quiet I know how to open the router ports and create 2 firewall rules, since you all use the 5000 as the 80, my 5000 is reserved for something else and must therefore be changed / re-routed).
5000:5000 = ❌
5000:myport1 = ❌
myport1:5000 = ❌
myport1:myport1 = ❌

and the confirmation lies in the fact that:
5000:5000 = ✔ (ONLY locally);
myport1:5000 = ✔ (ONLY locally);

----------------------------------------------------------------------------------------------------------------------------------------------------------

For the rest, nothing to say. It does its dirty job, although the theory would like the sync to be bidirectional and only for THE SAME VIDEO (in a nutshell, the room is now global, when instead the room should be created when opening the video you want to watch and lock lobby to that video only. By doing this you can use bidirectionality and, prevent people from opening a video at random with the bad expir. of: everyone starts the video which the master lobby has opened recklessly).

As it is now, the master does what he wants and the followers have to follow him like slaves. I say this because, if a follower pauses, at the master, the video continues to go on, to then reinforce the play to those who have paused. And this goes against the sense of "watch together" ... it would be no different than using discord with streaming (solution used for yesterday 🙃🤬).

However it is a good project 👍.

Edited by Eremitak
Removed expletives. This is a family friendly community. And more intel about sync
Link to comment
Share on other sites

  • 1 month later...
megasnapper
On 2/22/2021 at 9:35 AM, danlo315 said:

So I decided to take another stab at getting this up and running for me.  Turns out that my reverse proxy conf was faulty on websockets and I could not control other players.  This is now fixed on my end.

 

 

Hi danlo315,

Would you mind sharing your proxy config settings? I've got emby running through my nginx proxy, but i'm struggling to get emby-sync working through it. (It works on my local network)

Edited by megasnapper
Link to comment
Share on other sites

danlo315

@megasnapperI actually stopped using it because it hasn't been stable for me.  But here's my reverse proxy.

 

server {
    listen         80;
    server_name    emby-sync.*;
    return         301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name [yourservername];
    ssl_certificate     [keyloation]/fullchain.pem;
    ssl_certificate_key [keyloation]/privkey.pem;

    #include /config/nginx/ssl.conf;
    client_max_body_size 0;

    location / {
        #set $upstream_app emby_test;
        #set $upstream_port 8096;
        #set $upstream_proto http;
        #proxy_pass $upstream_proto://$upstream_app:$upstream_port;
        proxy_pass http://emby-sync:5000;

        #proxy_set_header Range $http_range;
        #proxy_set_header If-Range $http_if_range;
        #proxy_set_header X-Real-IP $remote_addr;
        #proxy_set_header Host $host;
        #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

}


 

Link to comment
Share on other sites

  • 1 year later...
lastelement21

Pushed a few updates to this.  Merged in a refactor, fixed a couple things, added a couple features.  I sign in using my emby connect email (synced to an account in my emby server), and it works well.

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...