Reputation: 101
I have problem that play video on website. Firstly I used below code in localy and these code work . But when I public this page video does not play and give "no video with supported format or mime type " this error .I use IIS server in Windows. And this page is working under ASP.NET web site. Here is html code:
<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">Big</button>
<button onclick="makeSmall()">Small</button>
<button onclick="makeNormal()">Normal</button>
<br>
<video width="640" height="360" controls="controls">
<source src="files/Just.mp4" type="video/mp4" />
<object width="640" height="375" type="video/quicktime" data="files/Just.mp4"><!--<![endif]-->
<param name="src" value="files/Just.mp4" />
<param name="autoplay" value="true" />
<param name="showlogo" value="false" />
<!--[if gt IE 6]><!-->
</object><!--<![endif]-->
</video>
</div>
<script>
var myVideo = document.getElementById("video1");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function makeBig() {
myVideo.width = 560;
}
function makeSmall() {
myVideo.width = 320;
}
function makeNormal() {
myVideo.width = 420;
}
</script>
Upvotes: 1
Views: 252
Reputation: 28583
You have no id of video1. Put it after the video tag and then it should work
<!DOCTYPE html>
<html>
<body>
<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">Big</button>
<button onclick="makeSmall()">Small</button>
<button onclick="makeNormal()">Normal</button>
<br>
<video id="video1" width="420">
<source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
<source src="http://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg">
<param name="autoplay" value="true" />
<param name="showlogo" value="false" / Your browser does not support HTML5 video. </video>
</div>
<script>
var myVideo = document.getElementById("video1");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function makeBig() {
myVideo.width = 560;
}
function makeSmall() {
myVideo.width = 320;
}
function makeNormal() {
myVideo.width = 420;
}
</script>
</body>
</html>
Upvotes: 1