john depp john depp - 1 year ago 44
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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download