I'm creating an iphone webapp in dashcode for the first time and I can not figure out the code for embedding a video into the webapp.I have an html file and have a few pages it switches between but I need to create a function in javascript so when I click a button that it will pull up a video I in quicktime. Any sample code or thoughts? If anyone could give me some samplecode I would appreciate it
Asked
Active
Viewed 2,228 times
2 Answers
0
- create your .html file
- embed the following code :
<video src="your_movie_file.mov" controls="controls"> your browser does not support the video tag <video>
- upload your file to your webserver.
- test your files. (make sure your movie file in your webserver too...

mptyheart
- 1
- 1
-
yeah I have an html file and have a few pages it switches between but I need to create a function in javascript so when I click a button that it will pull up a video I have in quicktime. Any sample code or thoughts? – Colin Gray Feb 18 '10 at 06:27
0
You could try something like this (completely untested):
function showVideo(vidFile) {
var vidElem=document.createElement("video");
vidElem.setAttribute("src", vidFile);
vidElem.play();
}
And then invoke it like this:
showVideo("your_movie_file.mov");

icktoofay
- 126,289
- 21
- 250
- 231
-
Tested it on the desktop Safari and it works. It doesn't seem to work in iPhone Simulator, (and in fact, nothing relating to video did) and I don't have a physical device with me at the moment, so I can't test that currently. – icktoofay Feb 18 '10 at 06:39
-
okay thanks alot for the help do I have to embed a quicktime player for it to work on a mobile device? – Colin Gray Feb 18 '10 at 06:53