Start a new topic

Resume on recognition for video Using C#

I want to be able to make my videos to resume on recognition using C# in Unity.  Currently I have them working but when you move away from the target images and go back, the video starts from the beginning. Any help would be appreciated.


Hi, 


What are you using to render the videos? The VideoPlayer provided by Unity?

If the video augmentation is set as a drawable prefab on the Trackable, this is expected because the prefab is destroyed and recreated every time the target is lost and found again.

There are a number of ways to work around this, depending on the type of tracker you are using and your general setup. If you could provide more information about this, it would help us to find the best solution.


Best regards,

Alexandru

Yes I'm using the video player provided with Unity and setup the scene based on the "Image Tracking - Simple" scene in the Wikitude samples. I've seen some solutions where people used javascript to fix it, but Unity has moved away from it and is now concentrating on using C#.  If there is anything else I can provide to help figure it out, let me know. 


Thank you for your help!


Jeff

Hi, 


Is it possible for you to send us a small demo project that reproduces your issue? That would be the quickest way to find a solution.


Best regards,

Alexandru

Ok...I'll get a file ready.  What would be the best way to send it you?  What email should I use?  

The compressed file size is still 167MB.  I was thinking of using Wetransfer.com...

Hi, 


I apologize for the late reply.

Wetransfer should be fine.


Best regards,

Alexandru

Hi, 


I've updated the project so that the video correctly resumes when the image target is recognized again. I've attached a new script that implements this behavior, as well as the updated Conewango.scene that uses the script.


In summary, I've created a new script that listens to the OnImageRecognized and OnImageLost events from the ImageTrackable. When the image is lost, it saves the timestamp of the video, and when the image is found again, it applies the timestamp back to the VideoPlayer.


Please let me know if you have any other issues with it.


Best regards,

Alexandru

cs
(713 Bytes)

Thank you Alexandru!  I will check the files out and let you know how it works for me.   I have a need to apply it to several videos in my project.


Thanks again!


Jeff

Login or Signup to post a comment