UnityPlugin-AVProVideo
UnityPlugin-AVProVideo copied to clipboard
Android - Audio out of sync when using Unity audio output with a looping video
Describe the issue When using a looping video player on Android with the audio output set to Unity, the audio track loops before the video track, causing the two to desynchronize after the first loop. Does not occur with system audio output and with Unity audio on macOS/iOS.
Your Setup (please complete the following information):
- Unity version: 2021.3.9f1
- AVPro Video version (number and edition (trial/core/ultra/enterprise)): 2.6.2 ultra (Also reproduced on 2.4.0)
- Operating system version: Android 12/13
- Device model: Samsung Galaxy S21 Ultra, Google Pixel 6
- Video specs (resolution, frame-rate, codec, file size): 1080x1920, 30 FPS, H.264 + AAC audio, 32.6 MB
To Reproduce Build the sample project (sent by email) for Android and run. Observe the audio getting out of sync when the video player reaches the end of the video and loops.
Videos Video is in streaming assets in the sample project.
Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE
Instead email the link to us [email protected]
Hi @joseph-o3h,
Thank you for emailing your project file, that was helpful. I looked at the test media that you provided and found that the video length was 11s 84ms while the audio length was 11s 29ms, which may be causing the loop sync issues. We are looking into how Android treats this.
I think we have found the issue. A fix will be incoming in the next release of AVPro Video. If you need a fix sooner @joseph-o3h then please email me over your Unity invoice PDF and I will arrange to get you over an f2 build package.
The latest version has been released, please let us know if this has not fixed the issue for you.
Still seeing this on 2.6.7
@joseph-o3h,
Was it working for you in version 2.6.5 and has it since regressed or has it not been fixed at all? Is it still the same Android device?
We upgraded directly from 2.6.2 to 2.6.7 so don't know if it is a regression. Same device and same video file.
Ok, more changes have gone in to try and address this issue. I will include these in the next release.
The latest version has been released, please let us know if this has not fixed the issue for you.
It has been fixed in 2.7.1, but we have also found a similar issue when seeking (that has not been fixed). It can be reproduced by attaching this script to the media player
using System;
using UnityEngine;
using System.Collections;
using RenderHeads.Media.AVProVideo;
public class SeekVideo : MonoBehaviour
{
[SerializeField]
private MediaPlayer mediaPlayer;
public void Start()
{
StartCoroutine(DoSeek());
IEnumerator DoSeek()
{
yield return new WaitForSeconds(4f);
mediaPlayer.Control.Seek(5.91326492927655);
}
}
}
The seek time is important here - it only happens with certain seek times.
Yeah, I see that. Odd that I do not see it when seeking with the scrub bar in our Demo scene. This one is gonna need some deeper diving. I will schedule in some time to look deeper and get back to you on here when I have something to report.
@joseph-o3h I have sent you a plugin set to test via the unitysupport ticketing system
@joseph-o3h Did that help?
It didn't, I can still see it with the test plugin that you sent me.
I comment already in the IOS issue but here maybe it makes more sense:
- On Android (Oculus Quest VR headset)
- While playing a video (normal 2D video with a standar stereo audio track multiplexed on the video)
- If you remove the headset and put it back again the audio is delayed
A small change coming in the next version might have an impact on this issue.