Log in or register to post comments

How to load videos dynamically in VuforiaVideo Playback

February 5, 2017 - 10:49am #3

The problem is that I have 12 videos in app, and always 1-4 of them won't start. I've found out that this is due to memory: app loads all videos at the same time, and keeps them like that even if target is lost (maybe I'm wrong?). So you need to load the videos dynamically - load when needed, unload when not. All codes for ThrackableEventHandler.cs and VideoPlaybackBehaviour.cs doesn't work for me, maybe because they're to old.

Please help me...

 

How to load videos dynamically in VuforiaVideo Playback

February 6, 2017 - 2:48am #2

Videos are using a lot of memory. You definetly should not mantain all them in RAM at the same time. So when you have 12 video prefabs in scene, this means all 12 video may be loaded at the same time. Much better is to have say one video prefab container and load all videos into it one by one when needed. I hope some day Vuforia will make a sample project to demonstrate this approach. I was able to achive this time ago, and I remember this was not as easy.

Vuforia video is loacated in StreamingAssets folder. This means that videos are not loaded at the begining. You provide only path to them.

One problem then you may have is that certain videos is extreamly big, so they just do not fit in RAM, especially on iOS devices. I think Vuforia video plugin works the way to load all file into RAM before playing, so you have to be careful with large files.

One other thing to mention. Try to open profiler when and see memory usage. if you notice adding memory usage after new video opened, and no memory released from prevoius video, then you might want to fugure out how to liberate previous video from RAM manually.

How to load videos dynamically in VuforiaVideo Playback

February 6, 2017 - 8:22am #1
misher wrote:

Videos are using a lot of memory. You definetly should not mantain all them in RAM at the same time. So when you have 12 video prefabs in scene, this means all 12 video may be loaded at the same time. Much better is to have say one video prefab container and load all videos into it one by one when needed. I hope some day Vuforia will make a sample project to demonstrate this approach. I was able to achive this time ago, and I remember this was not as easy.

Vuforia video is loacated in StreamingAssets folder. This means that videos are not loaded at the begining. You provide only path to them.

One problem then you may have is that certain videos is extreamly big, so they just do not fit in RAM, especially on iOS devices. I think Vuforia video plugin works the way to load all file into RAM before playing, so you have to be careful with large files.

One other thing to mention. Try to open profiler when and see memory usage. if you notice adding memory usage after new video opened, and no memory released from prevoius video, then you might want to fugure out how to liberate previous video from RAM manually.

Thank you for info! Maybe you could remember what in general you did to load videos on one prefab? Not the code but just which scripts you added/modified and what your code did.

Log in or register to post comments