Application code in React
<video
ref={(input) => { this.video = input; }}
onError={this.onError}
>
<source src="https://xxx.mp4" type="video/mp4" />
</video>
Issue
When doing server-side rendering, if src of video is loaded earlier than onError being attached to video DOM, the onError wouldn't be called even if any error happens.
My attempt
tag will have similar issue but can be solved with checking 'complete' property of img element, like this answer, but video doesn't have corresponding property based on the MDN document.
There is a 'error' property of HTMLVideoElement, but when I use it, its value is always null even if the src of video tag is incorrect.
I also tried to work with 'readyState' and 'networkState' of HTMLVideoElement, but these two don't help on recognising if the loading of video src has error or hasn't been initialised yet.
Any of you have encountered the same situation and solved it? Thanks in advance for your help and ideas!