Home > Web Front-end > Front-end Q&A > What to do if html5 video does not play automatically

What to do if html5 video does not play automatically

WBOY
Release: 2021-12-21 10:29:43
Original
6314 people have browsed it
Solution: Add the "autoplay" attribute to the video tag video. The autoplay attribute specifies that the video will start playing as soon as it is ready. If this attribute is set, the video will automatically play. The syntax is "

What to do if html5 video does not play automatically

The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.

What to do if the html5 video does not play automatically

If you want to solve the problem that the video does not play automatically in html5, you need to use the autoplay attribute.

The autoplay attribute is a boolean (Boolean) attribute.

The autoplay attribute specifies that playback begins as soon as the video is ready. If this property is set, the video will play automatically.

The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
<video src="/i/movie.ogg" controls="controls" autoplay>
暂时没法播放
</video>
</body>
</html>
Copy after login

Output result:

What to do if html5 video does not play automatically

##Recommended tutorial: "

html video tutorial

The above is the detailed content of What to do if html5 video does not play automatically. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template