Home > Software engineering >  HTML code to run a local video file working fine on windows but not on android
HTML code to run a local video file working fine on windows but not on android

Time:12-08

<!DOCTYPE html>
<html>
<body>

<h3>Basic English Lesson Listen & Speak</h3>

<video width="320" height="240" controls>
  <source src="BASIC ENGLISH LESSON 14.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

</body>
</html>

The video file is in the same directory folder as my html file. I need guidance on why its not working on my android 11 OS tablet.

CodePudding user response:

You have to call video.play() in order to play videos in android

Try this:

<!DOCTYPE html>
<html>
<body>

<h3>Basic English Lesson Listen & Speak</h3>

<video width="320" height="240" controls>
  <source src="BASIC ENGLISH LESSON 14.mp4">
Your browser does not support the video tag.
</video>

</body>
<script>
var video = document.getElementById('video');
video.addEventListener('click',function(){
  video.play();
},false);
</script>
</html>

CodePudding user response:

It is about which browser you using , If your browser running on older version then you found this type of error. I suggesting you for use google chrome I think it will work fine.

or else you have to give full path of video if in your android drive.

  • Related