HTML5 video reload
Hi!
When you come from a page that contains a <video>, the browser still reloads the video several times.
An example here : http://gmorisseau.com/pjax/ Here the files : http://cl.ly/01172i2N2Y0T
Thanks for your help!
A temporary fix (CoffeeScript) :
$(document).on "pjax:beforeSend", ->
$("video").each ->
@pause()
@src = ""
@load = ""
You're right; good catch. Looks like nasty browser bug (I tested in Chrome; not sure about other browsers). We should try to apply some workaround like you suggested, but restore the src when the <video> tags get restored from pjax cache on popstate.
Hi Mislav,
Apparently Firefox reloads several times too. It's invisible in the Network panel, but you can hear the sound of the video play again and again : http://gmorisseau.com/pjax/ .
You're right about the src, I just realize my temporary fix doesn't work with the prev/next button ...
Hello
Problem is here (content is cloned to be put in cache) : https://github.com/defunkt/jquery-pjax/blob/master/jquery.pjax.js#L367
Tried without this line and it works. I didn't take time to dig more but it should be possible to store only strings in cache and create nodes when needed ?
Juste tried (strings in cache), it works. Is there any reason to keep jquery objects in cache ?
Strings in cache will consume less memory :-) but it could be a bc break for pjax:beforeReplace.
I'm having the same issue. I've tried the strings in cache approach, and it doesn't work with Firefox. However, using a CDN stops the reloading, for some odd reason.
Edit: The strings in cache approach works. I was just having some weird issues with Firebug.
I'd love it if there was an official solution though.
Hi guys,
I've just updated my test page with the latest version of pjax and the bug is back.
In the past, this fix worked for me but I can't find a solution with the new version of pjax.
Any idea?
Thanks!
I've just hit the same problem. Previously temp hack fix works. In standard JS + jQuery:
$pjaxContainer.on('pjax:beforeSend', () => {
$('video').each(function() {
this.pause();
this.src = '';
this.load = '';
});
});
or instead of setting these attributes just removing videos works too
$(this).remove();
Hello! Would you tell me when this bug is resolved?
Any further thoughts? Or is it time to move on?