Created
June 6, 2013 23:33
-
-
Save danro/5725870 to your computer and use it in GitHub Desktop.
Remove HTML5 video and clear src attribute to prevent leaks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove audio + video + stop all the downloadin’ | |
// assumes $video and $audio are jQuery selectors for <video> and <audio> tags. | |
var removeMedia = function () { | |
_.each([$video, $audio], function ($media) { | |
if (!$media.length) return; | |
$media[0].pause(); | |
$media[0].src = ''; | |
$media.children('source').prop('src', ''); | |
$media.remove().length = 0; | |
}); | |
}; |
@eladkarako Yeah, definitely a necessary thing especially for slow performant devices (e.g. Tizen 2.3 and 2.4)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Beraliv
Thanks! This was really useful.