Based on our 3 group of NetEase Cloud app production, find the Aplayer H5 music player

Source: Internet
Author: User

Aplayer is a very nice HTML5 audio player, UI
Reference fromNetEase Cloud Music external chain player。 It encapsulates the audio tag and makes a nice player UI with CSS that supports setting song names, singers and lyrics, can set whether to play automatically, supports thumbnails, supports playback progress, and sets the playback source.


HTML

The first is to load the player style file, the style of this player resembles NetEase cloud music player. Then load in Aplayer.js file. The player Div#player1 is then added to the body to display the playback.
<link rel= "stylesheet" href= "APlayer.min.css"> <!--body-to <div
Id= "Player1" class= "Aplayer" ></div> <!--/body-<script
Src= "APlayer.min.js"></script>
Js

Now let's call Aplayer, start with a new object, bind the Player element, set various options, and finally use Ap.init () to load the player. Note that Aplayer does not rely on third-party JS libraries, such as jquery or Zepto, which directly encapsulates the audio tags in HTML5, so developers can render beautiful music players on the page with just a few lines of code.
var ap = new Aplayer ({element:document.getElementById (' player1 '),
Narrow:false, Autoplay:true, Showlrc:false, music: {title:
' Preparation ', Author: ' Hans zimmer/richard Harvey ', url:
' Http://7xifn9.com1.z0.glb.clouddn.com/Preparation.mp3 ', Pic:
' Http://7xifn9.com1.z0.glb.clouddn.com/Preparation.jpg '}); Ap.init ();
Options
{element:document.getElementById (' player1 '),//optional, bound player element narrow:
False,//optional, narrow-screen style, which shows only thumbnails and play buttons, see the Style in demo demo 3 Autoplay:true,//optional,
Auto Play, note that this does not support AutoPlay on mobile phone showlrc:false,//optional, display lyrics, see the demo in the style 1
Music: {//required, musical related information set title: ' Preparation ',//required, music caption Settings Author:
' Hans zimmer/richard Harvey ',//required, music author set URL:
' Http://7xifn9.com1.z0.glb.clouddn.com/Preparation.mp3 ',//required,
Music actual reference address settings Pic: ' Http://7xifn9.com1.z0.glb.clouddn.com/Preparation.jpg '
Required, music cover reference address settings}}
Api

Aplayer also provides player events such as loading the player: Ap.init (); Play: Ap.play () and pause: Ap.pause ().
Ap.init () Ap.play () Ap.pause ()




Github:aplayer–https://github.com/diygod/aplayer

Based on our 3 group of NetEase Cloud app production, find Aplayer H5 music player

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.