MediaClip.CreateFromFileAsync() throws System.ArgumentException

Hong 1,216 Reputation points
2024-11-13T02:26:31.3266667+00:00

MediaClip videoClip = await MediaClip.CreateFromFileAsync(storageFileVideo);

The above code occasionally throws the following exception:

System.ArgumentException
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17


I want to emphasize that the code works flawlessly most of the time. It throws the exception only for some MP4 video files. When it throws the exception, I check the video file and it always plays perfectly. I even use Mp4 Explorer to examine the MP4 file and cannot find any problems.

Could anyone offer a tip on the possible causes?

Universal Windows Platform (UWP)
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.