Better handling of video errors

This commit is contained in:
Natsumi
2025-06-25 00:56:04 +12:00
parent c2a5c51234
commit c7fef6e00a
3 changed files with 15 additions and 19 deletions

View File

@@ -88,6 +88,7 @@ namespace VRCX
/// <param name="title">The title of the notification.</param> /// <param name="title">The title of the notification.</param>
/// <param name="body">The content of the notification.</param> /// <param name="body">The content of the notification.</param>
/// <param name="timeout">[CURRENTLY UNUSED]The timeout of the notification.</param> /// <param name="timeout">[CURRENTLY UNUSED]The timeout of the notification.</param>
/// <param name="opacity">The opacity of the notification (0.0 to 1.0).</param>
/// <param name="image">The image of the notification.</param> /// <param name="image">The image of the notification.</param>
public void OVRTNotification(bool hudNotification, bool wristNotification, string title, string body, int timeout, double opacity, string image = "") public void OVRTNotification(bool hudNotification, bool wristNotification, string title, string body, int timeout, double opacity, string image = "")
{ {

View File

@@ -12,6 +12,7 @@ namespace VRCX
/// <param name="title">The title of the notification.</param> /// <param name="title">The title of the notification.</param>
/// <param name="content">The content of the notification.</param> /// <param name="content">The content of the notification.</param>
/// <param name="timeout">The duration of the notification in milliseconds.</param> /// <param name="timeout">The duration of the notification in milliseconds.</param>
/// <param name="opacity">The opacity of the notification (0.0 to 1.0).</param>
/// <param name="image">The optional image to display in the notification.</param> /// <param name="image">The optional image to display in the notification.</param>
public void XSNotification(string title, string content, int timeout, double opacity, string image = "") public void XSNotification(string title, string content, int timeout, double opacity, string image = "")
{ {

View File

@@ -392,9 +392,7 @@ namespace VRCX
// logContext.onJoinPhotonDisplayName = string.Empty; // logContext.onJoinPhotonDisplayName = string.Empty;
// logContext.onJoinPhotonDisplayNameDate = string.Empty; // logContext.onJoinPhotonDisplayNameDate = string.Empty;
logContext.LastAudioDevice = string.Empty; logContext.LastAudioDevice = string.Empty;
logContext.LastVideoPlaybackError = string.Empty; logContext.VideoPlaybackErrors.Clear();
logContext.LastAVProError = string.Empty;
logContext.locationDestination = string.Empty;
VrcClosedGracefully = false; VrcClosedGracefully = false;
return true; return true;
@@ -439,10 +437,10 @@ namespace VRCX
fileInfo.Name, fileInfo.Name,
ConvertLogTimeToISO8601(line), ConvertLogTimeToISO8601(line),
"location-destination", "location-destination",
logContext.locationDestination logContext.LocationDestination
}); });
logContext.locationDestination = string.Empty; logContext.LocationDestination = string.Empty;
return true; return true;
} }
@@ -456,7 +454,7 @@ namespace VRCX
if (lineOffset >= line.Length) if (lineOffset >= line.Length)
return true; return true;
logContext.locationDestination = line.Substring(lineOffset); logContext.LocationDestination = line.Substring(lineOffset);
return true; return true;
} }
@@ -626,17 +624,16 @@ namespace VRCX
// 2025.05.04 22:38:12 Error - Attempted to play an untrusted URL (Domain: localhost) that is not allowlisted for public instances. If this URL is needed for the world to work, the domain needs to be added to the world's Video Player Allowed Domains list on the website. // 2025.05.04 22:38:12 Error - Attempted to play an untrusted URL (Domain: localhost) that is not allowlisted for public instances. If this URL is needed for the world to work, the domain needs to be added to the world's Video Player Allowed Domains list on the website.
const string youtubeBotError = "Sign in to confirm youre not a bot"; const string youtubeBotError = "Sign in to confirm youre not a bot";
const string youtubeBotErrorFixUrl = "\n[VRCX]: We've made a program to help with this error, you can try it out here: https://github.com/EllyVR/VRCVideoCacher"; const string youtubeBotErrorFixUrl = "[VRCX]: We've made a program to help with this error, you can grab it from here: https://github.com/EllyVR/VRCVideoCacher";
if (line.Contains("[Video Playback] ERROR: ")) if (line.Contains("[Video Playback] ERROR: "))
{ {
var data = line.Substring(offset + 24); var data = line.Substring(offset + 24);
if (data == logContext.LastVideoPlaybackError) if (!logContext.VideoPlaybackErrors.Add(data))
return true; return true;
logContext.LastVideoPlaybackError = data;
if (data.Contains(youtubeBotError)) if (data.Contains(youtubeBotError))
data += youtubeBotErrorFixUrl; data = $"{youtubeBotErrorFixUrl}\n{data}";
AppendLog(new[] AppendLog(new[]
{ {
@@ -652,12 +649,11 @@ namespace VRCX
if (line.Contains("[AVProVideo] Error: ")) if (line.Contains("[AVProVideo] Error: "))
{ {
var data = line.Substring(offset + 20); var data = line.Substring(offset + 20);
if (data == logContext.LastAVProError) if (!logContext.VideoPlaybackErrors.Add(data))
return true; return true;
logContext.LastAVProError = data;
if (data.Contains(youtubeBotError)) if (data.Contains(youtubeBotError))
data += youtubeBotErrorFixUrl; data = $"{youtubeBotErrorFixUrl}\n{data}";
AppendLog(new[] AppendLog(new[]
{ {
@@ -680,10 +676,9 @@ namespace VRCX
if (line.Contains("Attempted to play an untrusted URL")) if (line.Contains("Attempted to play an untrusted URL"))
{ {
var data = line.Substring(offset); var data = line.Substring(offset);
if (data == logContext.LastVideoPlaybackError) if (!logContext.VideoPlaybackErrors.Add(data))
return true; return true;
logContext.LastVideoPlaybackError = data;
AppendLog(new[] AppendLog(new[]
{ {
fileInfo.Name, fileInfo.Name,
@@ -1421,10 +1416,9 @@ namespace VRCX
{ {
public bool AudioDeviceChanged; public bool AudioDeviceChanged;
public string LastAudioDevice; public string LastAudioDevice;
public string LastVideoPlaybackError; public readonly HashSet<string> VideoPlaybackErrors = new(50);
public string LastAVProError;
public long Length; public long Length;
public string locationDestination; public string LocationDestination;
public long Position; public long Position;
public string RecentWorldName; public string RecentWorldName;
public bool ShaderKeywordsLimitReached; public bool ShaderKeywordsLimitReached;