Page 1 of 1
reload Mp4 on site return??
Posted: Mon 07 Apr 2014 1:01 am
by ace2
My website has a mp4 which updates every hour, but for some reason, firefox decides to playback the cached copy and not the site copy, even crtl f5 does solve this.
I don't want to disable cache on page as i've heard it can cause headaches.
so what are my options??
http://www.users.on.net/~ace2/minilapse.htm
Code: Select all
<p align="center"><video src="lapse1.mp4" width="100%" controls autoplay >HTML5 Video is required for this example</video> </p>
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 11:24 am
by SpaceWalker
How about adding a time parameter to the file name, such as (if PHP is available on your web hosting server):
Code: Select all
<p align="center"><video src="lapse1.mp4?<?php echo time(); ?>" width="100%" controls autoplay >HTML5 Video is required for this example</video> </p>
That will create a file name such as 'lapse1.mp4?1396869807' - the number will increment every seconds.
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 11:26 am
by ace2
SpaceWalker wrote:How about adding a time parameter to the file name, such as (if PHP is available on your web hosting server):
Code: Select all
<p align="center"><video src="lapse1.mp4?<?php echo time(); ?>" width="100%" controls autoplay >HTML5 Video is required for this example</video> </p>
That will create a file name such as 'lapse1.mp4?1396869807' - the number will increment every seconds.
Bloody internode don't allow php, bugga.....
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 11:42 am
by sfws
deleted as of no help
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 12:40 pm
by ace2
So adding that simple script into the problem page will solve this issue???
(Unable to test until tomorrow)
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 12:46 pm
by sfws
deleted as of no help
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 1:22 pm
by ace2
added
Code: Select all
<script type="text/javascript">
function changeImage(im) {
document.video.src="'lapse1.mp4?' + new Date().getTime()";
}
</script>
above the
still no luck..
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 1:31 pm
by sfws
(deleted as of no help)
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 2:57 pm
by ace2
sfws wrote:
Try having just the middle line within the script tags, and place the script just before
Ends with a no play or load video
The browser only knows that the page (document in javascript speak) has a
element (i.e. .video in javascript speak) after it has processed constructing the page. I think that is better than adding a call to the function at the end, but declaring the function at the start.
<video> and </video> on either side of video call already
Code: Select all
<p align="center"><video src="lapse1.mp4" width="100%" controls autoplay >HTML5 Video is required for this example</video> </p>
You think they would make this easy!
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 3:08 pm
by mcrossley
Try...
Code: Select all
<video id="vid1" width="100%" controls="" autoplay="">HTML5 Video is required for this example</video>
<script type="text/javascript">
document.getElementById('vid1').src='lapse1.mp4?' + new Date().getTime();
</script>
Edit: pasted the wrong element the first time, not the <video>!
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 3:18 pm
by mcrossley
A better solution may be...
Code: Select all
<!-- <video width="100%" controls="" autoplay="">HTML5 Video is required for this example</video> -->
<script type="text/javascript">
document.write('<video width="100%" controls="" autoplay="" src="lapse1.mp4?' + new Date().getTime() + '">HTML5 Video is required for this example</video>');
</script>
<noscript>
<video width="100%" controls="" autoplay="" src="lapse1.mp4">HTML5 Video is required for this example</video>
</noscript>
Re: reload Mp4 on site return??
Posted: Mon 07 Apr 2014 3:25 pm
by ace2
Thank you soooooooo much yet again.
The first one worked, so i'm not game to try the second!!!!!