How to properly unload/destroy a VIDEO element

后端 未结 15 2151
闹比i
闹比i 2020-12-04 07:58

I\'m working on a realtime media browsing/playback application that uses objects in the browser for playback, when available.

I\'m using a

15条回答
  •  忘掉有多难
    2020-12-04 08:40

    This snippet doesn't do any effecient DOM manipulations (no tag removal) and doesn't fire error event for unlike this answer:

    var video = document.getElementById('video');
    video.removeAttribute('src');
    video.load();
    

    Furthermore, it doesn't fire loadstart event. And it's like it should work - no video, no load start.

    Checked in Chrome 54 / FF 49.

提交回复
热议问题