Get the App
SLTechnology News&Howtos  ›  Development  › 

How does html5 start playing the current audio or video?

Shulou Source: shulou.com Published: 2022-06-03 15:04:54 10月05日 Update

This article will explain in detail how html5 can start playing the current audio or video, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.

examples

A video with play and pause buttons:

var myVideo=document.getElementById("video1");function playVid() { myVideo.play(); }function pauseVid() { myVideo.pause(); }

definition and use

The play() method starts playing the current audio or video.

browser support

All major browsers support the play() method.

Note: Internet Explorer 8 and earlier versions do not support this method.

syntax

audio|video.play()

Code Example:

video playback _window.onload =function(){ var ov=document.getElementById("a1"); ov.onmouseover=function() { this.play(); } ov.onmouseout =function() { this.pause(); } }; Your browser does not support about "html5 how to start playing the current audio or video" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Tags: Video support audio method browser article browse example more good practical mainstream code content button article comment version knowledge grammar Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Information NVidia Linux macOS