/    Sign up×
Community /Pin to ProfileBookmark

Trying to get a movie (.avi) file to play

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:

[b]In the HEAD section:[/b]

[quote]

<SCRIPT LANGUAGE=”JavaScript”> //Plays a movie file
function playMovie(name)
{ document.movie.src = name & “.avi”}
</SCRIPT>

[/quote]

[b]In the BODY section:[/b]

[quote]

(** 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()”>

[/quote]

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.

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@JonaJul 02.2003 — [i]Originally posted by CalifNina [/i]

[b]<SCRIPT LANGUAGE="JavaScript"> //Plays a movie file

function playMovie(name)

{ document.movie.src = name & ".avi"}

</SCRIPT>

[/B]
[/QUOTE]


[font=arial][color=maroon]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:[/color]
[/font]

[font=courier new]

<script type="text/javascript">

function playMovie(id){

document.getElementById(id).src = id+".avi";

}

</script>

[/font]

[i]Originally posted by CalifNina [/i]

[b](** Was not sure where this embed command was supposed to go **)

<embed src="video/bambi.avi" name="bambi">

[/b]
[/quote]


[font=arial][color=maroon]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 [b]name[/b] to [b]id.[/b] If your file is in a different folder, you may want to edit your Javascript to "video/"+id+".avi" instead of id+".avi";[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@CalifNinaauthorJul 02.2003 — Jona, thank you ... I did exactly as you stated:

[b]HEAD section:[/b]<script type="text/javascript"> //Plays a movie file

function playMovie(id){

document.getElementById(id).src = "video/"+id+".avi";

}

</script>[/quote]
[b]BODY section:[/b]<embed id="bambi">

<INPUT TYPE="button" VALUE="Click here to play a movie called bambi" onclick="playMovie()">[/quote]
But unfortunately will not play the movie file. Did I interpret what you stated correctly?

[b]OH also[/b], 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.
Copy linkTweet thisAlerts:
@JonaJul 02.2003 — [font=arial][color=maroon]I thought you knew, the EMBED tag must be closed:[/color][/font]

[font=courier new]

<embed id="bambi">[b]</embed>[/b]

[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@JonaJul 02.2003 — [i]Originally posted by CalifNina [/i]

[b]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. [/B][/QUOTE]


[font=arial][color=maroon]'Twasn't Dave? Who then, may I ask, would make an ASP mistake? ?[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@CalifNinaauthorJul 02.2003 — 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.
Copy linkTweet thisAlerts:
@JonaJul 02.2003 — [font=arial][color=maroon]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?[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@CalifNinaauthorJul 02.2003 — 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.
Copy linkTweet thisAlerts:
@CalifNinaauthorJul 02.2003 — 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.
Copy linkTweet thisAlerts:
@JonaJul 02.2003 — [font=arial][color=maroon]All right. If you ever put it online, post a link to it so that we can help you better.[/color][/font]

[b][J]ona[/b]
×

Success!

Help @CalifNina spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...