views:

66

answers:

3

Hello, I'm requesting this chunk of html from a mysql database:

<p>Hello.<br><video src="video/hi.mp4" width=100% height=100% autoplay="autoplay"></video>

It displays, but won't autoplay. On a static HTML page it goes off without a hitch. The request comes from an ajax call for a matching keyword that is being typed into a input bar.

Any ideas?

A: 

Aren't some quotes or attributes missing?

<video src="video/hi.mp4" style="width:100%; height=100%;" autoplay="autoplay"></video> ?
MatTheCat
No, I don't think so. from http://diveintohtml5.org/video.html<video src="pr6.webm" width="320" height="240"></video>
Jon Wilson
A: 

Your web browser doesn't know that the HTML came from an SQL database, so it's not likely that it behaves differently in the two cases. I'm inclined to assume that there is some other problem with the page.

What are the URLs of the static and dynamic pages? Does the relative URL "video/hi.mp4" resolve to the address of your video correctly in both cases?

Matthew Wilson
The URL's are the same. I understand that the browser isn't biased, but I just thought it might help in determining the cause of the problem.
Jon Wilson
Also, the 1st frame of the video displays, so it's finding it no problem.
Jon Wilson
I see you're saying the dynamic HTML comes from an AJAX call - so it's inserted into an existing page, it doesn't come from a brand new load of a page?
Matthew Wilson
Yes, it doesn't reload the page.
Jon Wilson
+1  A: 

Only thing I can imagine is that the browser has not finished loading the page and or not getting a onload(). Can you start the video using a script?

<video id="video" src="video/hi.mp4" autoplay ></video>

<script>

document.getElementById("video").play();

</script>

Wayne