john depp john depp - 1 month ago 8
Javascript Question

HTML5 video: changing video src makes the page unresponsive

I have a video element which i'm changing it's src attribute dynamically.
After 6 different videos the page becomes unresponsive.

I'm using flowplayer and angular if this makes any different.

Does anyone know what happens and what is the best practice of loading new sources?

This is the current code:

<video autobuffer crossOrigin="anonymous" id="videoplayer"></video>

var video = document.getElementById('videoplayer');
video.src = '/path/to/new/src/'


Answer Source

Rather than changing src, create and delete element. It will work