After playing around 20 short video clips (mp4's) in an HTML5 video control in a UIWebView in iOS, subsequent clips are failing with a
So I was setting the source like this:
$(vid).src = "some source file"; $(vid).play(); ... some other stuff happens ... $(vid).remove();
Doing it this way never removed the video from the decoder buffer, which meant that eventually it not be able to decode any more videos.
To fix this, this is how you must remove the video from the DOM:
$(vid).src = "some source file"; $(vid).play(); ... some other stuff happens ... $(vid).remove(); $(vid).src = ""; $(vid).load();
Now I realize that this doesn't make a ton of sense because after
.remove() is called, I would have assumed that the control has been removed from the DOM and any garbage collection would do the rest automatically. However, it doesn't work like that. I hope this helps other people.