Added a small delay to video loading, which seems to load them more reliably.

This commit is contained in:
Jamie Greunbaum 2026-03-07 21:03:13 -05:00
parent 380df620cf
commit 7b9d6c08e6

View File

@ -1,10 +1,8 @@
 
using UdonSharp; using UdonSharp;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Components.Video;
using VRC.SDK3.Image; using VRC.SDK3.Image;
using VRC.SDK3.UdonNetworkCalling; using VRC.SDK3.UdonNetworkCalling;
using VRC.SDK3.Video.Components.Base;
using VRC.SDKBase; using VRC.SDKBase;
using VRC.Udon.Common; using VRC.Udon.Common;
using VRC.Udon.Common.Interfaces; using VRC.Udon.Common.Interfaces;
@ -152,10 +150,10 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
_CaseVideoListCache = (VRCUrl[])_CaseVideoList.Clone(); _CaseVideoListCache = (VRCUrl[])_CaseVideoList.Clone();
} }
if (_VideoIndex != _OldVideoIndex) //if (_VideoIndex != _OldVideoIndex)
{ //{
_LoadNewVideoIndex(); // _LoadNewVideoIndex();
} //}
} }
@ -303,21 +301,20 @@ public class CaseVideoSyncPlayer : UdonSharpBehaviour
//_VideoLoadAttemptCounter = 0; //_VideoLoadAttemptCounter = 0;
//_UseFallback = false; //_UseFallback = false;
_LoadVideo_Private();
}
private void _LoadVideo_Private()
{
TryLoadURL(); TryLoadURL();
} }
public void TryLoadURL() public void TryLoadURL()
{ {
if (_VideoIndex >= 0 && _VideoIndex < _CaseVideoList.Length) if (_VideoIndex >= 0 && _VideoIndex < _CaseVideoList.Length)
{ {
_VideoPlayer.LoadURL(_CaseVideoList[_VideoIndex]);
SetVideoLoadStatus(IndicationStatus.Loading); SetVideoLoadStatus(IndicationStatus.Loading);
SendCustomEventDelayedSeconds(nameof(LoadNewVideoURL), 0.2f);
} }
} }
public void LoadNewVideoURL()
{
_VideoPlayer.LoadURL(_CaseVideoList[_VideoIndex]);
}
private void _PlayVideo_Private() private void _PlayVideo_Private()
{ {