Jump to content

Internet Explorer caches videos

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Ray

Ray

    Newbie

  • Members
  • Pip
  • 2 posts
We developed a site similar to YouTube...however there is a problem. When a viewer selects a video then selects another video the player, plays previous video. The title and description are correct but the video is always the previous video. I appears that
Internet Explorer caches videos. Using the Firefox browser on my workstation, I was unable to reproduce the "duplicate video" problem that I was viewing with Internet Explorer.

Is there code that would affect the way Internet Explorer caches video content?

Could this be an html issue not a php issue?

How can we fix this issue?

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
First I'd have to ask how you are presenting the videos to the user?

One way to get around browser caching is to create a random number and attach an arbitrary value to the URL. For example, if you look at CodeCall Programming (homepage) the images there are randomly selected via PHP. Normally it would display the same image for all three segments but I created a random number and attached it as I explained above. The image URL looks like this:

http://www.codecall....p?value=<Random Number>

The random number causes browser to load the content as new content. Not sure if this will help you in your case though.

#3
Ray

Ray

    Newbie

  • Members
  • Pip
  • 2 posts
currently the video is presented like this
/index.php?file=pages/final_video&id=165

what should change here and should this be done for all videos?

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
You could implement what I stated above. Attach the random number like this:

/index.php?file=pages/final_video&id=165&<argument>=<random number>

For example:
/index.php?file=pages/final_video&id=165&random=902436787

You can use the PHP rand() function attach this and yes, it should be done to all videos and should change each time the video is called. This may not be the best method but it works well for images.

Another method may be to look at the header() output and disable caching. We use this in our community project ionFiles to prevent file caching:

        header("Pragma:no-cache");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Cache-Control: public");