This introduces the specific operation method of playing and pausing music mp3, mav and other files on web pages through html5 code. In this way, for users, the online playable function can greatly improve the efficiency of the site and also bring a certain amount of traffic. I hope it will be helpful to friends in need. Here we need to first understand the two important tags in html5.
Wulin.com web development website has compiled this article for everyone to play and pause music mp3, mav and other files on the web page through html5 code. If this article is helpful in your work or study, please come back often. For more exciting tutorials, please visit our homepage. The following are the tutorials to browse:
This introduces the specific operation method of playing and pausing music mp3, mav and other files on web pages through html5 code. In this way, for users, the online playable function can greatly improve the efficiency of the site and also bring a certain amount of traffic. I hope it will be helpful to friends in need. Here we need to first understand the two important tags in html5.
1. HTML 5 <embed> tag, it is a new tag in HTML 5, and this tag must have the src attribute.
2. HTML 5 <audio> controls attributes
The controls property specifies that the browser should provide playback controls for the audio. If this property is set, it is specified that there is no script control set by the author.
The specific code example of html display audio is as follows:<!DOCTYPE HTML><html><body><audio controls=controls> <source src=so.ogg type=audio/ogg> <source src=so.mp3 type=audio/mpeg> <embed height=100 width=100 src=song.mp3 /> </audio> </body> </html>
The above code displays the following effect on the page:
Note:
The numbers in width and height respectively represent the width and height of the player.
src can be modified to your own music address later.
This is the end of the articles that use html5 code to play and pause music mp3, mav and other files in web pages. Welcome to browse other contents of this site. Click here to return to the homepage