|
-
Dec 26th, 2010, 04:02 PM
#1
Thread Starter
New Member
Play video in html5
Hey guys, I need some help, I've been scratching my head on this one for a while and still can't seem to accomplish my task. What I am trying to do is make an html5 webpage which can play video. Now I know you must be thinking "oh that is piece of cake, just slap in those <video></video> tags and a couple of src's together and u'll be good". Well no I have accomplished that but now there is a twist. I want to make it be able to the user to upload their own video that is from their hard drive and play the video in my video player (the html5 video player). Here is what I plan on doing, the user clicks on upload and the file path string is then stored in a variable (javascript i think) and then when I press another button which says "play video" it will replace the video src with the string that is stored. I know this can be done because you just directly paste a video link from your computer and can play it. So all I need is how to change the src. Here is the code I have so far.
Code:
<!DOCTYPE>
<html>
<head>
<title>
Player
</title>
<body bgcolor="black">
<script> var video = document.getElementsByTagName( 'video' )[0]; </script>
</head>
<body>
<br>
<br>
<hr size="1" width=80%>
<br> <br>
<center>
<div style="width:800px; background-color: #ffffff;-moz-border-radius: 5px;-webkit-border-radius: 5px;border: 1px solid #000;padding: 10px;" >
<center>
<font face="arial" size="3" color="white">
<input type="file" id="datafile" name="datafile" size="78643200"> <br><br>
<INPUT TYPE="button" id="go" size="5" VALUE="Play Media File" onclick="video.play()">
</font>
</center>
</div>
</center>
<video src="datafile"></video>
</body>
</html>
Thanks alot guys
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|