MovieTexture Lag on AudioSource, Replaying

I’m trying to get a MovieTexture to replay relatively smoothly.
Currently I’m calling Stop() then Play() manually as the .loop attribute doesn’t work (neither does .duration)

When I call Stop(), then Play(), the final frame is shown for a second, the audio plays straight away, then movie finally catches up wth the audio after dropping first set of frames.

Interestingly when I do not play audio, the movie restarts perfectly with no dropped frames.

I made a small script to test the various combinations of Play/Pause/Stop and MovieTexture/AudioSource

I found some interesting quirks:

  • Playing and stopping a movie without starting its AudioSource has no lag.
  • However once its AudioSource has Play() called on it, it makes the movie lag on Start()/Stop().
  • Pausing the AudioSource doesn’t pause movie playback.
  • However resuming paused audio playback causes movie lag.
  • Stopping movie supposedly rewinds the clip, but the texture is not cleared.
  • Calling Play() an paused audiosource before calling Play() on its paused MovieTexture causes the sound to be half as quiet.
  • Pausing the movie pauses the sound.
  • Calling Play() on a paused movie’s SoundSource causes it to loop the current sample.

The fact that MovieTexture doesn’t clear when stopped is a problem too.
I can set renderer.mainMaterial to a black diffuse when I call Stop(), but when I call Start() again and re-assign the MovieTexture, it shows the last frames of the video clip.

I’m not sure what’s causing this.
There are no huge spikes in CPU.
The movie is extremely small, only 190px by 108px, and 20s in length.
I’ve set my ffmpeg encoding to output a large number of keyframes, so it should be able to play at the start.

Does anyone know how to stop AudioSource from adversely affecting a MovieTexture in this way?
Also how to force a MovieTexture to clear when Stopped?

Any other tricks to solve this issue. I see the same in Unity 5.

I have this problem but found a temporary workaround.

I have the audio of the movietexture set to an audiosource on the same object, then when I want to make calls to the clip, I make the call on both the movietexture component and audiosource component