<video> element with empty src-attribute creates console warning "Invalid URI. Load of media resource failed."

Viewed 60

I have a video tag with an empty src-attribute. This is because i change the src based on what the user clicks. So i fill in the video-src after the page load. Now when i load the page i get the following warning in firefox:

Invalid URI. Load of media resource  failed.

The tag:

<video id="media-player-video" class="js-player" src=""></video>

Is it possible to not check the source attribute on page-load to fix this?

1 Answers

Try adding preload="none" to your video tag:

<video id="media-player-video" class="js-player" src="" preload="none"></video>

Visit here for a preload attribute documentation

Related