john depp john depp - 5 months ago 23
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.pause();
video.src = '/path/to/new/src/'
video.load();


Thanks!

Answer Source

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