So we have a game that plays movies onto textures.
I have had great success using native code plugins to play the movies, but I am having a few problems using the built in movietexture.
When you play a movietexture, there seems to be a large CPU spike when the movie ends. Normally when you only play one unique movie, this doesnt cause an issue, but when you play multiple movies, it can actually cause a movie’s audio to rapidly loop the end of it’s audio. This occurs even with small movies, like 256x256 pixel.
Looking at the profiler, I see a huge jump in the “overhead” element of the CPU category when a movie ends. This also occurs if the movie was set to loop.
The overhead jumps from approx 1 - 3 ms to about 26ms for approx 20 frames
I have found two somewhat lousy work arounds to this problem.
- Add approximately 1 second of silence to the end of the movie to ensure the looping occurs with silence
- Seperate the audio from the movies
One other bizzare thing is, even when you preview the movies in the Unity editor, they will skip/loop the audio at the end. I am mystified why this issue hasnt occurred for anybody else. I found no mention of it when googling.
The movies in question are OGV movies that play fine in VLC
[EDIT] It appears if I do not play the audio portion of the movies, the spike is almost non-existent.
Can anyone provide any insight into this problem?
Thanks in advance.