当前位置:   article > 正文

html5音乐播放器模版,HTML5小型音乐播放器 - Aplayer

html aplayer lrc

82d5913ac6b90bf2a8671326c6528b36.png

OPTION:

var option = {

element: document.getElementById('player1'), // Optional, player element

narrow: false, // Optional, narrow style

autoplay: true, // Optional, autoplay song(s), not supported by mobile browsers

showlrc: 0, // Optional, show lrc, can be 0, 1, 2, see: ###With lrc

mutex: true, // Optional, pause other players when this player playing

theme: '#e6d0b2', // Optional, theme color, default: #b7daff

mode: 'random', // Optional, play mode, can be `random` `single` `circulation`(loop) `order`(no loop), default: `circulation`

preload: 'metadata', // Optional, the way to load music, can be 'none' 'metadata' 'auto', default: 'auto'

listmaxheight: '513px', // Optional, max height of play list

music: { // Required, music info, see: ###With playlist

title: 'Preparation', // Required, music title

author: 'Hans Zimmer/Richard Harvey', // Required, music author

url: 'http://7xifn9.com1.z0.glb.clouddn.com/Preparation.mp3', // Required, music url

pic: 'http://7xifn9.com1.z0.glb.clouddn.com/Preparation.jpg', // Optional, music picture

lrc: '[00:00.00]lrc here\n[00:01.00]aplayer' // Optional, lrc, see: ###With lrc

}

}

API:

ap.play() // Resume play

ap.play(time) // Set currentTime

ap.pause() // Pause

ap.toggle() // Toggle between play and pause

ap.volume(percentage) // Set volume

ap.on(event, handler) // Event binding

ap.setMusic(index) // Switch music

ap.lrc // Lrc time and text

ap.playIndex // Current playing index

ap.audio // Return native audio, most native api are supported

ap.audio.currentTime // Returns the current playback position

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/247550
推荐阅读
相关标签
  

闽ICP备14008679号