Share via

MediaClip.CreateFromFileAsync() throws System.ArgumentException

Hong 1,526 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?

Developer technologies | Universal Windows Platform (UWP)

Your answer

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