In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly analyzes the relevant knowledge points of HTML5 audio tags using js for playback control examples, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about "HTML5 audio tags using js for playback control examples".
Tags can play audio files in a HTML5 browser.
There is a control panel by default, but sometimes we just need to play the sound, and the control panel is up to us to define the state of its display.
Here we can use JS for control.
The code is as follows:
Var audio; _ window.onload = function () {initAudio ();} var initAudio = function () {/ / audio = document.createElement ("audio") / / audio.src='Never Say Good Bye.ogg'audio = document.getElementById ('audio');} function getCurrentTime (id) {alert (parseInt (audio.currentTime) +': seconds');} function playOrPaused (id,obj) {if (audio.paused) {audio.play (); objxss _ clean] = 'pause'; return;} audio.pause () OBJ [XSS _ clean] = 'play';} function hideOrShowControls (id,obj) {if (audio.controls) {audio.removeAttribute ('controls'); obj [XSS _ clean] =' display control frame 'return;} audio.controls =' controls'; OBJ [XSS _ clean] = 'hide control frame' return;} function vol (id,type, obj) {if (type = = 'up') {var volume = audio.volume + 0.1 if (volume > = 1) {volume = 1;} audio.volume = volume } else if (type = = 'down') {var volume = audio.volume-0.1 if (volume playback is muted
Current volume:-
What are the characteristics of html 1, simplicity: hypertext markup language version upgrade using superset mode, thus more flexible and convenient, suitable for beginner front-end developers to use. 2. Extensibility: the wide application of hypertext markup language brings the requirements of strengthening functions and increasing identifiers. Hypertext markup language adopts the way of subclass elements to ensure the expansion of the system. 3. Platform independence: hypertext markup language can be used on a wide range of platforms, which is one of the reasons why the World wide Web is so popular. 4. Versatility: HTML is the universal language of the network, which allows web producers to create complex pages that combine text and pictures, which can be viewed by anyone else on the Internet, no matter what type of computer or browser they are using.
On the "HTML5 audio tag using js playback control example" is introduced here, more related content can search previous articles, hope to help you answer questions, please support the website!
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: 0
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.