I have a problem using the video player - I can load a video and seek anywhere in the video, but sometimes (not predictable when) on seek Unity throws an error and I can’t figure out why and how to work around it. Here’s my code:
[SerializeField] private RawImage rawImage;
[SerializeField] private Slider seekSlider;
VideoPlayer videoPlayer;
void Start() {
videoPlayer = gameObject.AddComponent<VideoPlayer>();
videoPlayer.renderMode = VideoRenderMode.APIOnly;
videoPlayer.playOnAwake = false;
videoPlayer.source = VideoSource.Url;
videoPlayer.prepareCompleted += player => rawImage.texture = player.texture;
seekSlider.onValueChanged.AddListener(v => videoPlayer.time = v);
videoPlayer.url = *path to local .mp4 file*;
videoPlayer.Play();
}
The video plays nicely. Seeking works anywhere in the video. Except sometimes (about 1 in 10) when it gives me the following error:
WindowsVideoMedia error 0xc00d6d60
while reading
(path to my mp4 file)Context:
IMFSourceReader::WaitForSample in
ReadSample Error details: A valid type
has not been set for this stream or a
stream that it depends on. Track
types: Unreadable Track
I am on Windows 10, using Unity 2019.3.2f1
Any ideas?