Using the Poster in Unity

Hey! Thanks for Depthkit, we’re really enjoying using it to play back our Azure Kinect captures.

I have a question about the Poster which is designed to let you see something in the Editor while the game isn’t running.

Our captures spends a lot of time paused and I would like to be able to use “poster mode” when it’s paused rather than having a paused video player. I feel like it’s going to be more stable, and I can also select my paused frame rather than using the first frame of the video (or jumping around the video).

The Poster starts on if I start the video paused but when I stop the video I can’t figure out how the bring the poster back. Is there a way? This would be really nice, thanks.

1 Like

Hey Colin, thanks for reaching out about this! I totally hear your use case and think you could try something like the following:

In the Depthkit_Clip class we expose an event API via the Events variable that you can use as a way to subscribe to the player events generated by an attached player. In there is a “PlaybackPaused” event that you can subscribe to (check out the Depthkit_APIExample.cs file for an example of how to do this).

My thought is that you could subscribe to that event, and on a player being paused you can force the poster to be shown in that moment by flipping a variable in the attached Clip script called showPoster or something similar.

To account for the flipped variable, you could make a small change to the Depthkit_Clip script, specifically this line (in RefreshRenderValues():

if (Application.isPlaying && IsSetup)

and change it to this

if (Application.isPlaying && IsSetup && !showPoster)

That way, this will force the renderer to use the poster logic in the else if this variable is flipped instead of requesting the next frame from the Player.

Let me know if this works for you!

1 Like

Ah yeah this seems to be working well! Man I was looking at this code too, feel like a bit of a maroon for not figuring this out myself. Thanks!

1 Like

No worries! I know working with video inside game engines isn’t the most ergonomic thing haha.