1

Edit: This was a known bug, and was fixed in Unity 2018.1, details can be found here.

I have a .mp4 video, with H264 video encoding and AAC audio encoding.

I'm loading this video using a Video Player node to load it onto a texture, with a seperate audio source for playing the audio.

I initialise my video like so:

_videoPlayer.source = VideoSource.VideoClip;
_videoPlayer.clip = introVideo;

//Set Audio Output to AudioSource
_videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
//Assign the Audio from Video to AudioSource to be played
_videoPlayer.EnableAudioTrack(0, true);

_videoPlayer.SetTargetAudioSource(0,_audio);
_audio.volume = 1f;

_videoPlayer.Prepare();

while (!_videoPlayer.isPrepared)
{
    yield return null;
}

_videoPlayer.Play();

This method works fine when running on a Mac. However, when I create a build and deploy it to my iPad, the audio is jumpy, and will finish significantly ahead of the video.

Is there something I can do to stop the audio from skipping?

Luke4792
  • 455
  • 5
  • 19
  • How large is the video, whats the resolution, what is the bitrate of the audio. It may be that you are just using to much system resource. – Jonathan Ogle-Barrington Apr 09 '18 at 16:44
  • Must call `VideoPlayer.Prepare()` and must wait for `videoPlayer.isPrepared()` to be true before playing the video. – Programmer Apr 09 '18 at 20:28
  • The video is 112mb, 1m 10s long, 1080p, and has a bitrate of 12mb/s. I've updated my question to reflect the changes i made regarding using prepare, but even after the changes I'm having exactly the same issues. I don't think this is a duplicate of the question linked, as I'm not having a problem actually playing the audio, the problem is it skips, and plays too fast. – Luke4792 Apr 10 '18 at 09:41
  • Turns out this was a unity bug that was fixed in the latest beta version (2018.1b), as documented here: (https://issuetracker.unity3d.com/issues/ios-videoplayer-vp8-video-sound-plays-faster-than-video) Consider unmarking this question so I can put this as an answer? – Luke4792 Apr 10 '18 at 14:23

0 Answers0