PDA

View Full Version : Can't get video to reload.



gib65
02-12-2015, 11:50 PM
I have a video on my web page that looks like this:

<video id="Video" class="Video" controls="controls" autoplay="autoplay" preload="none">
<source id="VideoSource" src="" type="video/mp4" />
</video>

I also have some javascript that does an ajax call to get the video source, and when it returns, it does this:

var video = $("Video").get(0);
video.src = data.MoviePath;
video.load();
video.play();

The first time this happens, the video plays fine. But I have a mechanism by which the user can select another video from a drop down. When this happen, I run the same javascript function to do the AJAX call. It returns and runs the same code as above (I've verified this), but this time it display the video screen with the message "Invalid Source". I know the source is not invalid. I checked the source string it's assigning to video.src and it exists on my machine. It's also in the exact same format as the source for the first video (which runs fine).

Can anybody explain what might be happening?