title: javascript/html: Replacing embedded videos memory leak?
body: <p>I was wondering how to best replace embedded videos on a webpage.  I have a bunch of video files (avi) that a visitor will be able to select and watch. </p>
  
  <p>I am pretty new to javascript and html, but what I am currently doing is embedding the videos on the webpage as objects, and when a new video is selected, I change the url param for the object.  This changes the video correctly, however after a few videos the browser becomes unresponsive.  Looking at the task manager, the memory usage goes up with each video opened.  </p>
  
  <p>I originally thought that since the object has the same id, it would delete the first video and load the next.  However, it seems like the first video is still in memory.  Is there a better way to do this?  </p>
  
  <p>I am using using Windows 7, Windows Media Player 12, IE8.  I am also wondering if this could be related to these technologies, because it doesn't seem to leak memory when I run this on my older PC (Windows XP, WMP 9, IE8).</p>
  
  <p>Here is basically what I am doing:
  Video tags in html:</p>
  
  <pre><code>    &lt;object width="100%" height="100%" id="video"
      classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"&gt;
      &lt;param name="url" value="video1.avi"&gt;
      &lt;param name="autostart" value="1"&gt;
      &lt;param name="uiMode" value="full" /&gt;
      &lt;/object&gt;
  </code></pre>
  
  <p>Then when a user selects a new video (javascript - assume newVideoPath contains the path to the next video to play):</p>
  
  <pre><code>    $("video").url = newVideoPath;
  </code></pre>
  
  <p>Is there any memory cleanup I should be taking care of?</p>