RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
224 stars 27 forks source link

AVPro 2 + Timeline video scrubbing in Editor #755

Open obviousjim opened 3 years ago

obviousjim commented 3 years ago

Hi RenderHeads,

Can you advise on how to connect the Editor preview frame to the timeline Playhead so that the video can be scrubbed in the Timeline in Editor? thanks!

We're big fans of AVPro here at Scatter. Our volumetric video tool Depthkit integrates directly with it, and we recommend it to all of our users above the Unity Video Player. Thanks for your amazing product!!

One key area where the Unity Video Player still wins out is that the Unity Video Playable timeline component supports scrubbing videos in Editor on the timeline.

We are in the process of upgrading to AVPro 2 and trying to get that functionality working without success. We feel like it should be possible because the AVPro Component has a timeline scrubbing slider in the Editor. 

You can see an example of what I mean in the beginning of this tutorial where we set up the timeline for scrubbing.

Thanks so much!

kahnivore commented 3 years ago

Hi @obviousjim

This shouldn't be too hard to implement and is our roadmap, but probably won't be attended to immediately. One thing to note is that our code for the timeline is kept separate so as not to create a dependency, so you'd need to inherit from the iTimeControl interface.

Keijiro does a similar implementation that might be useful, have a look here. Specifically this line.

We'll take a closer look at this soon to advise on this more. Let us know how you get on.

m1keall1son commented 3 years ago

Hello @kahnivore

I was able to get what we needed working by modifying the timeline playables rather than using the ITimelineControl interface. That interface is designed to allow a class to easily work with a Control Track in the absence of playables. Since you already have playables in there, there was no need for that and I could just modify them directly.

The main issue was that the media player seems to have some dependency on Application.isPlaying which isn't always the case with timeline. Luckily I could call some of the update and render functions directly on the Player from the timeline code in the event the Application wasn't in play mode. That worked swimmingly.

krisrok commented 3 years ago

@m1keall1son is this something you'd be willing to share here?

obviousjim commented 3 years ago

Hey @krisrok, @m1keall1son and I would be happy to share but we need permission from @kahnivore / RenderHeads to do so because we modified their code and we don't want to violate their license agreement.

@kahnivore any objections to us sharing the modified code that enabled timeline scrubbing to work well?

AndrewRH commented 3 years ago

@obviousjim that's fine, no problem - scripts can be shared, just don't share the native plugin/DLL files.

Thanks,

AndrewRH commented 3 years ago

Feel free to post your scripts here so others can also benefit :)

m1keall1son commented 3 years ago

Thanks @AndrewRH, for convenience I've put them into this repo. @krisrok hope this can be useful for you.