在ios上销毁/卸载视频对象HTML5

时间:2012-11-06 01:11:03

标签: ios html5 video memory-leaks

我正在将多个视频加载到ios应用的webview中的一个视频对象中。观看几个视频后,应用程序会崩溃,假设内存泄漏。我正在寻找一种方法来正确地转储流或在视频暂停和关闭时,或在加载新视频之前销毁之前的视频。任何帮助将不胜感激:

<video class="videoPlayer" preload="auto" controls="controls">
    <source src="" type="video/mp4" />
</video>

function LoadNewVideo() {
    video = document.getElementsByTagName('video')[0];
    video.src = "assets/vids/vid" + vidSelect + ".mp4";
    video.load(); // need this for the new video to load
    video.play();
}

function StopVideo() {
    video.pause();
    // kill current video here
    // i've tried the following codes but didn't work
    video.src = '';
    video.load();
}

0 个答案:

没有答案