Jump to content

Watch Party


chef

Recommended Posts

chef

This is a WatchParty:

    public class WatchParty
    {
        public long ItemId { get; set; }
        public List<SessionInfo> Members { get; set; }
        public string ControllingDeviceId { get; set; }
    }

 

So it's not a dictionary, and we have the ability to easily add things like maybe a start time, and other properties in the future.

 

Link to comment
Share on other sites

rbjtech
9 minutes ago, chef said:

I don't know. 

Should it?  Might be to complicated at first.

As Luke always says "it's possible for the future, thanks" 😳😁.

Most likely we should just handle movies to start. What do you think?

yes absolutely - I had not even thought about this for TV - films is the priority for sure imo. 

  • Like 1
Link to comment
Share on other sites

chef

here we go :) 


            var config = Plugin.Instance.Configuration; //We'll just use the plugin config to save Party data. Seems fine.

            //Our Admin user. We may need to control sessions based on them somewhere here.
            var admin = UserManager.GetUsers(new UserQuery()).Items.FirstOrDefault(user => user.Policy.IsAdministrator);

            if (e.Item.Parent.Name != "Watch Party") return; //We don't care about anything else, just Watch Party.

            //A Party! I love parties!

            var party = config.Parties.FirstOrDefault(p => p.ItemId == e.Item.InternalId); //<== This party exists. The User just selected it.
           
            //Add the session to the party.
            party?.Members.Add(e.Session);

            //We need to stop Emby from actually playing anything after the item is selected - Pause the session?
            //What happens if the user has Custom Intros?? Needs testing. That could be a problem.
            await SessionManager.SendPlaystateCommand(null, e.Session.Id,
                new PlaystateRequest()
                {
                    Command = PlaystateCommand.Pause, 
                    ControllingUserId = admin?.Id.ToString() //There is that admin user.

                }, CancellationToken.None); 

 

Link to comment
Share on other sites

BillOatman

Geez I am away for a little bit and you guys get it all sorted out! :)

The watch party library is a clever idea!

One thing to caveat, there are clients (Roku I believe, not sure if any others) that do not support remote control pause/unpause.  Nothing to do really until those commands become available except document it.

For things like custom intros that pop up.  Keep it simple at first, tell users/servers to turn it off.  Then work on a solution for post day 1.

Edited by BillOatman
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

rbjtech
21 minutes ago, BillOatman said:

One thing to caveat, there are clients (Roku I believe, not sure if any others) that do not support remote control pause/unpause.  Nothing to do really until those commands become available except document it.

Good shout.  Thanks.

It sorta makes sense to 'stop' the play session - as you probably don't want something paused on your screen - not sure.   As long as you can keep pinging the user with messages (eg .. Waiting for others to join .. ) every 30 seconds or something - then that is probably ok for starters.

edit - infact from memory I think you can also set the message to need acknowledgement ?

Yea - just don't include any timeouts .. 

image.thumb.png.debcab91c47cfddb2a60a2032ad1458b.png

Edited by rbjtech
  • Agree 1
Link to comment
Share on other sites

chef
5 minutes ago, BillOatman said:

Geez I am away for a little bit and you guys get it all sorted out! :)

The watch party library is a clever idea!

One thing to caveat, there are clients (Roku I believe, not sure if any others) that do not support remote control pause/unpause.  Nothing to do really until those commands become available except document it.

Really??

Yikes! Sorry Roku users you're not invited to the party. 😬... 

I hear there is going to be chips and pop.  (To soon??)

But in all seriousness, we'll have to handle that.

Perhaps there is a way to have the Roku user be the party admin, and start the actual playback?

Or, by the time this actually works, Roku can be invited. 😀

 

Link to comment
Share on other sites

chef

If we use the PlaybackProgress event, we should be able to watch for custom intros.

If the current stream is custom intro length, let it play.

But once the stream switches to the actual item with a long runtime, we'll send the pause command.

@BillOatman I think we did this sort of thing in some of the Home Automation plugins a couple years ago.

We only acted once the stream was long enough to be the actual movie.

 

Interestingly enough, you could have a custom intro that mentions the Party: "Welcome to the Watch Party, please wait for the party to start" custom intro.

But, that's waaaay in the future.

Edited by chef
  • Like 2
  • Agree 1
Link to comment
Share on other sites

BillOatman
10 minutes ago, chef said:

If we use the PlaybackProgress event, we should be able to watch for custom intros.

If the current stream is custom intro length, let it play.

But once the stream switches to the actual item with a long runtime, we'll send the pause command.

@BillOatman I think we did this sort of thing in some of the Home Automation plugins a couple years ago.

We only acted once the stream was long enough to be the actual movie.

Honestly at first I'd keep it simple and say turn those intros off. Then once it's released tackle stuff like that.

Yeah for the lighting plugins we checked for the length and if it was shorter than something like 5 min we assumed it was a preroll and didn't touch the lights.  But even that had issues, users that played "shorts" like some animations, the lights never changed. I think we asked for a preroll flag indicator we could use, but I can imagine it was like number 5,128,673 on the priority list :)

There is chatter in the Roku areas about that being supportable in future. Rather than try and work around it now, let those guys work their magic. Maybe a plugin like this would give them even more incentive :)

Edited by BillOatman
  • Like 1
  • Agree 1
Link to comment
Share on other sites

rbjtech
1 minute ago, BillOatman said:

Honestly at first I'd keep it simple and say turn those intros off. Then once it's released tackle stuff like that.

Yeah for the lighting plugins we checked for the length and if it was shorter than something like 5 min we assumed it was a preroll and didn't touch the lights.  But even that had issues, users that played "shorts" like some animations, the lights never changed.

There is chatter in the Roku areas about that being supportable in future. Rather than try and work around it now, let those guys work their magic. Maybe a plugin like his would give them even more incentive :)

Agree 100% - lets get this 'functional' on the absolute basics - then if that works and is usable/acceptable - then start looking at the edge cases. 👍

  • Agree 2
Link to comment
Share on other sites

rbjtech
10 minutes ago, chef said:

Interestingly enough, you could have a custom intro that mentions the Party: "Welcome to the Watch Party, please wait for the party to start" custom intro.

But, that's waaaay in the future.

This sort of thing is definitely a @Cheesegeezer speciality !

  • Like 1
  • Haha 1
  • Agree 2
Link to comment
Share on other sites

BillOatman
13 minutes ago, chef said:

Interestingly enough, you could have a custom intro that mentions the Party: "Welcome to the Watch Party, please wait for the party to start" custom intro.

But, that's waaaay in the future.

That actually would give the party-goers confirmation all is well.  Someday ;)

2 minutes ago, rbjtech said:

This sort of thing is definitely a @Cheesegeezer speciality !

Sure does, with all kinds of pretty animations! :)

  • Like 2
Link to comment
Share on other sites

chef

 

Seems like we can do the following so far:

1. create the library

2. intercept playback

3. pause the session when it is a watch party item

4. Create a party? Or at least have a party

 

@rbjtech what does a strm file look like again?

what is in side it?

I'm not as familiar with strm files, and we need to know how the events are going to react to them, and how the library is going to look.

 

Edited by chef
Link to comment
Share on other sites

37 minutes ago, chef said:

Really??

Yikes! Sorry Roku users you're not invited to the party. 😬... 

I hear there is going to be chips and pop.  (To soon??)

But in all seriousness, we'll have to handle that.

Perhaps there is a way to have the Roku user be the party admin, and start the actual playback?

Or, by the time this actually works, Roku can be invited. 😀

 

The ability to control the experience on the Roku will only work on the local LAN. Meaning those users at the same location already. Which sort of makes this hard to do on the Roku for that reason. The Roku External Control Protocol (ECP) will only work locally on the LAN.

The Roku app used to be able to use a web socket with an external listener. But that did not include the ability to "launch" into the application. The application had to already be running. Roku has changed certification requirements. Roku is forcing developers to implement deep-linking and ECP into their applications if they are public applications that serve video streams.

https://developer.roku.com/docs/developer-program/discovery/implementing-deep-linking.md

Because of this change think of the Roku more on terms with second screen type applications. Where the second screen can contain the Emby remote control interface, such as the web app, or other such things.

https://developer.roku.com/docs/developer-program/debugging/external-control-api.md

With Roku the context requested to play must come from within the network. Roku has blocked any attempt to access their API from an external location.

Threads such as the above used to be able to work on almost every Roku around the world that wasn't firewalled. Every single model until Roku introduced Roku OS 8. Ever since it has been LAN only. Just giving this as a reason not to give up on this entirely. But to not count on Roku being able to participate. It isn't us. It is them. Apologies.

 

Edited by speechles
  • Like 2
  • Thanks 3
Link to comment
Share on other sites

chef
Just now, speechles said:

The ability to control the experience on the Roku will only work on the local LAN. Meaning those users at the same location already. Which sort of makes this hard to do on the Roku for that reason. The Roku External Control Protocol (ECP) will only work locally on the LAN.

The Roku app used to be able to use a web socket with an external listener. But that did not include the ability to "launch" into the application. The application had to already be running. Roku has changed certification requirements. Roku is forcing developers to implement deep-linking and ECP into their applications if they serve public video streams.

Because of this change think of the Roku more on terms with second screen type applications. Where the second screen can contain the Emby remote control interface, such as the web app, or other such things.

With Roku the context requested to play must come from within the network. Roku has blocked any attempt to access their API from an external location.

Threads such as the above used to be able to work on almost every Roku model until Roku introduced Roku OS 8. Ever since it has been LAN only. Just giving this as a reason not to give up on this entirely. But to not count on Roku being able to participate. It isn't us. It is them. Apologies.

 

You do a great job @speechles!  The Roku app is amazing. All my Roku users are very happy with their experience. Thanks for coming by and explaining the current circumstance :) 

  • Like 1
Link to comment
Share on other sites

rbjtech
2 minutes ago, chef said:

 

Seems like we can do the following so far:

1. create the library

2. intercept playback

3. pause the session when it is a watch party item

4. Create a party? Or at least have a party

 

@rbjtech what does a strm file look like again?

what is in side it?

I'm not as familiar with strm files, and we need to know how the events are going to react to them, and how the library is going to look.

 

its just a single line text file containing the location of the media file location.

eg - file.strm

\\media\Films\Dune (2021) [tmdbId=438631]\Dune (2021) - WEBDL-1080p 8bit x264 EAC3 Atmos 5.1.mkv

On it's own, it will have no images or metadata, but that's fine for testing - we can make it look nice later on by just using it's associated poster.jpg etc

Link to comment
Share on other sites

chef
6 minutes ago, rbjtech said:

its just a single line text file containing the location of the media file location.

eg - file.strm

\\media\Films\Dune (2021) [tmdbId=438631]\Dune (2021) - WEBDL-1080p 8bit x264 EAC3 Atmos 5.1.mkv

On it's own, it will have no images or metadata, but that's fine for testing - we can make it look nice later on by just using it's associated poster.jpg etc

So, when the library is created, we create a folder in the file system which will contain the library contents.

 

 

Watch Party (virtual folder)

---> Points to file system folder: "Watch Party"

-------> "Dune" (folder)

                          -------> "Dune (2020).strm (file)

-------> "Another Watch Party" (folder)

                          -------> "Another Watch Party (2022).strm (file)

 

Or is the parent folder unnecessary, and the .strm files just get dropped in the main parent folder?

 

 

Watch Party (Virtual Folder)

---> Points to file system folder: "Watch Party"

                              --------> Dune (2020).strm (file)

                              --------> "Another Watch Party (2022).strm (file)

 

 

Sorry for my crappy folder structure drawing. LOL!

Edited by chef
Link to comment
Share on other sites

rbjtech

Main parent folder is fine - if we want more than one party (lol) then we are gonna need to put it in a sub folder. 

For my testing - I'm just using this as an example - where the root/library is \\media\WatchTogether\

\\media\WatchTogether\Dune (2021) [tmdbId=438631]\

Ignore all the other files in there for the moment - all we need is the strm file.

image.png.6c252024affef7546b64c14eaa41c086.png

Link to comment
Share on other sites

BillOatman
5 minutes ago, rbjtech said:

Main parent folder is fine - if we want more than one party (lol) then we are gonna need to put it in a sub folder. 

For my testing - I'm just using this as an example - where the root/library is \\media\WatchTogether\

\\media\WatchTogether\Dune (2021) [tmdbId=438631]\

Ignore all the other files in there for the moment - all we need is the strm file.

image.png.6c252024affef7546b64c14eaa41c086.png

I see the srt file.  If we have the strm file in the party library and it points to a movie that has the srt file, will the deaf or hard of hearing party goers have the option to have subtitles on?

Link to comment
Share on other sites

rbjtech
1 minute ago, BillOatman said:

I see the srt file.  If we have the strm file in the party library and it points to a movie that has the srt file, will the deaf or hard of hearing party goers have the option to have subtitles on?

If embedded then yes and as long as we copy the external SRT(s) - then yes.  Each user session is no different from the normal item in terms of playback experience.

Link to comment
Share on other sites

BillOatman
1 hour ago, rbjtech said:

If embedded then yes and as long as we copy the external SRT(s) - then yes.  Each user session is no different from the normal item in terms of playback experience.

Cool. If its easy to put the srt file(s) (if they exist) in the party library then maybe we do that day one, if not easy day 2.  I'm sensitive to this as I have several deaf friends :)

  • Agree 1
Link to comment
Share on other sites

MrMackey

I just wanted to say thank you guys for developing watch together ❤️

I have been waiting for this for a very long time.

Link to comment
Share on other sites

samuelqwe
6 hours ago, rbjtech said:

There are a few clunky ways to do it such as using the Playlist's but an idea which I played with for a bit - and may have some merit - is if you want to join the 'party' then you literally go into a 'WatchTogether' library which acts as the 'lobby' and in there is the film(s) that are being played.

These are actually just STRM files to the other real files in other libraries.   Maybe have a 'start time' incorporated into the film title so you know when it's gonna start.

To 'join' you actually click to play the film - the plugin is polling for new 'sessions' and if associated with the above film id - then it knows that user wants to join the party.  It then sends a session to restart the playback and then pauses.  It can send a message to the user telling them they have joined.

If you wanna leave, then just abandon the playback of that item.

When the admin is ready - then the sessions are released and playback begins on all the sessions that have joined.

You can control permissions on joining etc using the library permissions model.

Just saw this and this is actually one of the ideas I had in mind. Great minds think alike 😁

  • Like 1
Link to comment
Share on other sites

chef

Looks like the crews all here.

1 hour ago, samuelqwe said:

Just saw this and this is actually one of the ideas I had in mind. Great minds think alike 😁

News Cast Assemble!

I imagine this is going to be pretty good. 👍

  • Like 1
Link to comment
Share on other sites

BillOatman
5 hours ago, speechles said:

The ability to control the experience on the Roku will only work on the local LAN. Meaning those users at the same location already. Which sort of makes this hard to do on the Roku for that reason. The Roku External Control Protocol (ECP) will only work locally on the LAN.

The Roku app used to be able to use a web socket with an external listener. But that did not include the ability to "launch" into the application. The application had to already be running. Roku has changed certification requirements. Roku is forcing developers to implement deep-linking and ECP into their applications if they are public applications that serve video streams.

https://developer.roku.com/docs/developer-program/discovery/implementing-deep-linking.md

Because of this change think of the Roku more on terms with second screen type applications. Where the second screen can contain the Emby remote control interface, such as the web app, or other such things.

https://developer.roku.com/docs/developer-program/debugging/external-control-api.md

With Roku the context requested to play must come from within the network. Roku has blocked any attempt to access their API from an external location.

Threads such as the above used to be able to work on almost every Roku around the world that wasn't firewalled. Every single model until Roku introduced Roku OS 8. Ever since it has been LAN only. Just giving this as a reason not to give up on this entirely. But to not count on Roku being able to participate. It isn't us. It is them. Apologies.

 

Great explanation, thanks!

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