Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does html5 start playing the current audio or video?

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 225

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report