How do I change the src of an html5 video via javascript without either crashing chrome or leak memory?

I've been the same problem I read in some foruns that is a chrome's bug with memory leaks (some people say that just happens in chrome 8 and in chrome 6 works fine, but I didn't test it) I also read that using a sleep helps. I tried and it is true, if I put a sleep before change url atribute and call load() the crashes number decreases. But still continues to crash after many changes Then, I tried to use setTimeout (unlike sleep, it doesn't bloq CPU, leaving it free to chrome's work) And it is working now.

Try to see if my code helps var videoChangingPending = false; function changeMovieSource(url, title){ var $video = $('#video'); try { document. GetElementById('video'). Src = url; } catch (e) { alert(e); } $video.

Attr('autoplay', 'true'); $video. Data('currentTitle', title); document. GetElementById('video').load(); videoChangingPending = false; } function startPlayer(url, title) { if(videoChangingPending == true) return; document.

GetElementById('video').pause(); videoChangingPending = true; var changeMovieCallback = function(){ changeMovieSource(url, title);} var t = setTimeout(changeMovieCallback, 800); }.

I've been the same problem. I read in some foruns that is a chrome's bug with memory leaks (some people say that just happens in chrome 8 and in chrome 6 works fine, but I didn't test it). I also read that using a sleep helps.

I tried and it is true, if I put a sleep before change url atribute and call load() the crashes number decreases. But still continues to crash after many changes. Then, I tried to use setTimeout (unlike sleep, it doesn't bloq CPU, leaving it free to chrome's work).

And it is working now. Try to see if my code helps. Var videoChangingPending = false; function changeMovieSource(url, title){ var $video = $('#video'); try { document.

GetElementById('video'). Src = url; } catch (e) { alert(e); } $video. Attr('autoplay', 'true'); $video.

Data('currentTitle', title); document. GetElementById('video').load(); videoChangingPending = false; } function startPlayer(url, title) { if(videoChangingPending == true) return; document. GetElementById('video').pause(); videoChangingPending = true; var changeMovieCallback = function(){ changeMovieSource(url, title);} var t = setTimeout(changeMovieCallback, 800); }.

I would assume the first way should work fine, and Chrome's implementation is still buggy. Feel free to mention it on their bug report forums.

1 I agree it must be a bug, but still would be nice if anyone knew a workaround – Martin Jespersen Jan 14 at 18:40 Unfortunately I don't, I haven't had a need for video tags yet. But the sooner you mention it on their site, the faster it will get fixed! – Blindy Jan 14 at 18:50.

I was experiencing this problem so all I did was remove the video tag and then add another with the current url "on the fly".

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions