Click to See Complete Forum and Search --> : Trying to get a movie (.avi) file to play
CalifNina
07-01-2003, 07:44 PM
About a week and a half ago I asked how to callup and play a movie file. I was given some code pieces. Took those and edited/played with them, but not working. If someone would pls tell me what I did wrong:
In the HEAD section:<SCRIPT LANGUAGE="JavaScript"> //Plays a movie file
function playMovie(name)
{ document.movie.src = name & ".avi"}
</SCRIPT>In the BODY section:(** Was not sure where this embed command was supposed to go **)
<embed src="video/bambi.avi" name="bambi">
(** Then setup a button to click to play the movie **)
<INPUT TYPE="button" VALUE="Click here to play a movie called bambi" onclick="playMovie()">Essentially I have one movie file named "bambi.avi" in a folder named "video" Obviously I have put it together incorrectly... somewhere. Please advise on my errors.
Originally posted by CalifNina
<SCRIPT LANGUAGE="JavaScript"> //Plays a movie file
function playMovie(name)
{ document.movie.src = name & ".avi"}
</SCRIPT>
I supposed Dave helped you with this, eh? This is the second time I've seen him accidentally get confused with JavaScript and ASP. The ampersand (&) in the above code should be a plus (+) sign.
Also, for compatibility, I would code the above as follows:
<script type="text/javascript">
function playMovie(id){
document.getElementById(id).src = id+".avi";
}
</script>
Originally posted by CalifNina
(** Was not sure where this embed command was supposed to go **)
<embed src="video/bambi.avi" name="bambi">
In the above, you don't need to put a SRC. That is filled in by the Javascript, otherwise the AVI file will play automatically. In the above, change name to id. If your file is in a different folder, you may want to edit your Javascript to "video/"+id+".avi" instead of id+".avi";
[J]ona
CalifNina
07-01-2003, 08:15 PM
Jona, thank you ... I did exactly as you stated:
HEAD section:<script type="text/javascript"> //Plays a movie file
function playMovie(id){
document.getElementById(id).src = "video/"+id+".avi";
}
</script>BODY section:<embed id="bambi">
<INPUT TYPE="button" VALUE="Click here to play a movie called bambi" onclick="playMovie()">But unfortunately will not play the movie file. Did I interpret what you stated correctly?
OH also, no it was not Dave that had helped me on this one originally. He has helped on many, but this was not one of them.
I thought you knew, the EMBED tag must be closed:
<embed id="bambi"></embed>
[J]ona
Originally posted by CalifNina
OH also, no it was not Dave that had helped me on this one originally. He has helped on many, but this was not one of them.
'Twasn't Dave? Who then, may I ask, would make an ASP mistake? :D
[J]ona
CalifNina
07-01-2003, 08:25 PM
ooh! dumdum me!! Correct ... added in the ending tag </embed>. ((duh))
Still not working, if you are sure the code is correct, then I'll leave it alone and maybe something in my overall html file is stopping it from executing.
Thk you for the advise and corrections, at least I am closer than what I was before.
Do you have this online? You might want to try adding autostart="true" to your EMBED tag. If you have a link, may I see the page online?
[J]ona
CalifNina
07-01-2003, 08:29 PM
Had to go back and find the thread on who had helped me before ... was on 6/19, CrazyGaz was kind enough to help me on that day.
CalifNina
07-01-2003, 08:37 PM
OK, added in the autostart="true" into the EMBED tag ...still not playing the movie when I click on the button ... I bet it's something somewhere in my overall page that's cutting it short. I'll try troubleshooting.
Oh btw No, my HTML file is not online. It's just on my laptop.
Thk you though Jona, I know I am very close with all the corrected code you supplied, probably something stupid in my file or a syntax error somewhere. I'll keep working on it.
All right. If you ever put it online, post a link to it so that we can help you better.
[J]ona