Jump to content

Webhooks Playback Event with Cinema Intro


BillOatman

Recommended Posts

BillOatman

Hi:  With Cinema Intro turned on when I played a movie I got the following webhook playback events in order

playback.start
playback.pause Note that I did not pause it
playback.stop
playback.scrobble
playback.start

Questions:
1) What are the pause and scrobble events for?
2) Is there a way to know that the first set of calls is for the intro?  I didn't see anything in the data.

@chef

I wonder if all these extra events is what was/is causing at least some of the issues we were seeing the the Philips Hue plugin.

Link to comment
Share on other sites

Quote

What are the pause and scrobble events for?

I'm not sure about pause. That could just be the player firing a pause event while media is changing or loading. Scrobble is when it becomes fully played as part of the watching process.

Link to comment
Share on other sites

BillOatman
1 hour ago, Luke said:

I'm not sure about pause. That could just be the player firing a pause event while media is changing or loading. Scrobble is when it becomes fully played as part of the watching process.

Thanks.  But the 2nd question is the big one ...

2) Is there a way to know that the first set of calls is for the intro?  I didn't see anything in the data.

For things that deal with lights and other things based on a movie say starting, it would look not great if the lights lowered during the intro, raised partially at the end when it got the pause event, raised all the way when it got the stop event.  Then lowers the light again on the movie play event.

Worst case I suppose I could have people name their intro files with some marker text like "tHiSiSaInTrO" or something.  Obviously it would be immensely better to know its an intro by something in the payload.

Link to comment
Share on other sites

First set of what calls? Generally the answer is no. The client just sticks the intros at the front of it's now playing queue and then it gets played like any other video.

Link to comment
Share on other sites

BillOatman
1 hour ago, Luke said:

First set of what calls? Generally the answer is no. The client just sticks the intros at the front of it's now playing queue and then it gets played like any other video.

My webhook endpoint,  the playback messages for the intro.  But you answered the question, thanks.

Link to comment
Share on other sites

There's no reason we couldn't add this information to make it available to you. It just would have to start with getting our apps to report it to the server.

Link to comment
Share on other sites

BillOatman
16 hours ago, Luke said:

There's no reason we couldn't add this information to make it available to you. It just would have to start with getting our apps to report it to the server.

Thanks, probably not a bad thing to put on your list of things to do.  I suspect anything consuming the playback events would like that information available to avoid bouncing from state to state more frequently than necessary.  I'll put something in the feature request area.

Link to comment
Share on other sites

chef

I think the plugins check for the runtime of the media item, and they ignore playback if the runtime in under a certain amount of ticks....

And after looking at the code, those runtime ticks checks don't exists. They weren't added. 

Nice find. I'll add them to all the playbackstarted events.

 

Link to comment
Share on other sites

BillOatman

Oh yeah forgot about that ...

private const long TicksPerMinute = 600000000;
private readonly long FiveMinutesTicks = TicksPerMinute * 5;

// A preroll (or intro) is defined as anything that is less than 5 minutes in duration
bool isPreroll = e.MediaInfo.RunTimeTicks < FiveMinutesTicks;

 

Link to comment
Share on other sites

  • 9 months later...

I would like to get this working for me as well.  I do have a successful automation setup with SEQUEmatic and IFTTT.  After setting up Cinema Intros, I am running into the same issues with lights turning on and off during the transitions between the videos.  Have you been able to remedy this?  If so, can you please share?

Link to comment
Share on other sites

BillOatman
1 hour ago, JGWNet said:

I would like to get this working for me as well.  I do have a successful automation setup with SEQUEmatic and IFTTT.  After setting up Cinema Intros, I am running into the same issues with lights turning on and off during the transitions between the videos.  Have you been able to remedy this?  If so, can you please share?

For the prerolls you mean?  I use the code in my post above yours, basically it checks the length of what is going to be played and if it is less than 5 minutes the assumption is that it is a preroll so don't send any light commands.

Link to comment
Share on other sites

Yes, thank you for the response.  I have not worked with coding on Emby.  Where exactly does the code get embedded.  And did this work for you?

Link to comment
Share on other sites

BillOatman
4 hours ago, JGWNet said:

Yes, thank you for the response.  I have not worked with coding on Emby.  Where exactly does the code get embedded.  And did this work for you?

It's Emby plugin code, I assumed thats what you were working on.  Yes it does work.

Link to comment
Share on other sites

jwityshyn

This is awesome work, but can you share how this was accomplished?  What dll file needs to be altered?  Where does the code need to be placed?  Do you have a tutorial?  I think you would solve the issues of many users that are stumped with this, including me.

Link to comment
Share on other sites

BillOatman
25 minutes ago, jwityshyn said:

This is awesome work, but can you share how this was accomplished?  What dll file needs to be altered?  Where does the code need to be placed?  Do you have a tutorial?  I think you would solve the issues of many users that are stumped with this, including me.

I'm not understanding you at all,  but the code that I posted on April 1 is from the open source Emby plugin here.

I experimented with Emby webhooks once some time ago but didn't have much luck.  What you would do in a webhook solution to determine if a preroll is being played I really don't know for sure.  But if in the webhook handler you have access to how long the video is (plugins use MediaInfo.RunTimeTicks) you would not send commands to your lighting system if the length of the video is less than 5 minutes.  If you do not have that information I doubt you can tell as Emby thinks it is just a video to play, nothing special.

Hopefully this answers your question.

Edited by BillOatman
Link to comment
Share on other sites

jwityshyn

I was hoping to find a solution for Webhooks with IFTTT and Alexa, but it looks like this is not an option with what you have.  Thanks anyway.

Link to comment
Share on other sites

BillOatman
1 hour ago, jwityshyn said:

I was hoping to find a solution for Webhooks with IFTTT and Alexa, but it looks like this is not an option with what you have.  Thanks anyway.

If what you are trying to do is send a message to a IFTTT endpoint (API) when playback starts/stops/pauses, then I suggest you look at that plugin I referenced above.  It does exactly that, the only difference is instead of calling a IFTTT endpoint it calls a Philips Hue endpoint to run a scene (that sets various light levels).

 var sceneUrl = $"http://{config.BridgeIpAddress}/api/{config.UserToken}/groups/0/action";

It would mean pivoting from Emby webhooks to a plugin, but would probably end up being easier.

 

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