HTML5 Video Javascript
Posted
by
user373721
on Stack Overflow
See other posts from Stack Overflow
or by user373721
Published on 2010-12-26T02:47:32Z
Indexed on
2010/12/26
2:54 UTC
Read the original article
Hit count: 160
html5-video
Hi, I am not experienced in Javascript, I have the following script to play video files on Andriod phone, and it works fine.
<script type="text/javascript">
function PlayMyVideo(arg) {
var myVideo = document.getElementById([arg]);
myVideo.play();
}
</script>
<video id="what" src="what.mp4" poster="" />
<input type="button" onclick="PlayMyVideo('what')" value="Play" />
I am trying to write the tag on the fly:
<script type="text/javascript">
function PlayVideo() {
new_video = document.createElement('video');
new_video.setAttribute('scr', 'what.mp4');
new_video.play();
}
</script>
<input type="button" onclick="PlayVideo()" value="Play2" />
Nothing happen, would appreciate your suggestions. Thanks in advance
© Stack Overflow or respective owner