Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

react-music-player

> 前端框架
Open source

[Stop the maintenance] :musical_note: Maybe the best beautiful HTML5 responsive player component for react :)

763 stars0 likes2 views
WebsiteGitHub

About

[Stop the maintenance] :musical_note: Maybe the best beautiful HTML5 responsive player component for react :)

react-jinke-music-player

:musical_note: Maybe the best beautiful HTML5 responsive player component for react : )

中文文档

:package: Installation

using yarn :

bash
yarn add react-jinke-music-player

using npm :

bash
npm install react-jinke-music-player --save

:framed_picture: Screenshots

mini mode

Light Theme

Dark Theme

mobile

:sparkles: Feature list

  • Beautiful ui and animation
  • Responsive
  • Support theme switch
  • Support typescript (d.ts)
  • Support lyric
  • Support audio list sortable
  • Play list
  • Full player features
  • Server-Side Rendering
  • Import in Browser
  • Complete hook function
  • Custom operation ui
  • Custom downloader
  • Support destroy player
  • Support glass background
  • Media session (v4.11.0)
  • Support internationalization (v4.11.0)
  • Customize theme (v4.11.0)
  • Customize audio duration (v4.13.0)
  • Customize player icon (v4.17.0)
  • Follow the theme of the system (v4.16.0)
  • Audio volume fadeIn/fadeOut (v4.20.0)

:eyes: Example

live example :

  • https://lijinke666.github.io/react-music-player/

local example : http://localhost:8081/

Source Code

:memo: Usage

javascript
import React from 'react'
import ReactDOM from 'react-dom'
import ReactJkMusicPlayer from 'react-jinke-music-player'
import 'react-jinke-music-player/assets/index.css'

ReactDOM.render(
  ,
  document.getElementById('root'),
)

:clipboard: API

Name Type Default Description
className string - Additional CSS class for the root DOM node
audioLists AudioListProps[] - Detail
theme light | dark | auto dark color of the music player theme dark, light, auto (follow system)
locale zh_CN | en_US | CustomLocale en_US Detail
icon Customize player icon - Customize player icon
defaultPosition object {top:0,left:0} audio controller initial position with left,top,right,and bottom
playModeShowTime number 600 play mode toggle show time (ms)
bounds object,number body specifies movement boundaries. Accepted values: parent restricts movement within the node's offsetParent (nearest node with position relative or absolute), or a selector, restricts movement within the targeted node An object with left, top, right, and bottom properties. These indicate how far in each direction the draggable can be moved.
preload boolean,string false Whether to load audio immediately after the page loads. can be set to `auto
remember boolean false The next time you access the player, do you keep the last state
glassBg boolean false Whether the player's background displays frosted glass effect
remove boolean true The Audio Can be deleted
defaultPlayIndex number 0 Default play index of the audio player
playIndex number 0 play index of the audio player
defaultPlayMode string order default play mode of the audio player options can be set to order,orderLoop,singleLoop,shufflePlay or omitted
mode string mini audio theme switch checkedText can be set to mini,full or omitted
once boolean false The default audioPlay handle function will be played again after each pause, If you only want to trigger it once, you can set 'true'
autoPlay boolean true Whether the audio is played after loading is completed. mobile devices are invalid autoplay-policy-changes
toggleMode boolean true Whether you can switch between two modes, full => mini or mini => full
drag boolean true audio controller is can be drag of the "mini" mode
seeked boolean true Whether you can drag or click the progress bar to play in the new progress.
showMiniModeCover boolean true audio cover is show of the "mini" mode
showMiniProcessBar boolean false audio progress circle bar is show of the "mini" mode
showProgressLoadBar boolean true Displays the audio load progress bar.
showPlay boolean true play button display of the audio player panel
showReload boolean true reload button display of the audio player panel
showDownload boolean true download button display of the audio player panel
showPlayMode boolean true play mode toggle button display of the audio player panel
showThemeSwitch boolean true theme toggle switch display of the audio player panel
showLyric boolean false audio lyric button display of the audio player panel
showMediaSession boolean false https://web.dev/media-session/
lyricClassName string - audio lyric class name
extendsContent ReactNode | boolean | string - Extensible custom content like <>button1 button2
defaultVolume number 1 default volume of the audio player , range 0-1
loadAudioErrorPlayNext boolean true Whether to try playing the next audio when the current audio playback fails
responsive boolean true Whether to turn on the response mode, if set false, audio controller always show desktop ui
onAudioDownload function(audioInfo) - audio is downloaded handle
onAudioPlay function(audioInfo) - audio play handle
onAudioPause function(audioInfo) - audio pause handle
onAudioSeeked function(audioInfo) - When the user has moved/jumped to a new location in audio handle
onAudioVolumeChange function(volume) - When the volume has changed handle min = 0.0 max = 1.0
onAudioEnded function(currentPlayId,audioLists,audioInfo) - The single song is ended handle
onAudioAbort function(currentPlayId, audioLists, audioInfo) - audio load abort The target event like {...,audioName:xx,audioSrc:xx,playMode:xx}
onAudioProgress function(audioInfo) - audio play progress handle
onAudioError function(errMsg,currentPlayId, audioLists, audioInfo) - audio load failed error handle
onAudioReload function(audioInfo) - audio reload handle
onAudioListsChange function(currentPlayId,audioLists,audioInfo) - audio lists change handle
onAudioPlayTrackChange function(currentPlayId,audioLists,audioInfo) - audio current play track change handle
onAudioPlayModeChange function(playMode) - play mode change handle
onAudioListsPanelChange function(panelVisible) - audio lists panel change handle
onThemeChange function(theme) - theme change handle
onModeChange function(mode) - mode change handle
onAudioListsSortEnd function(oldIndex,newIndex) - audio lists sort end handle, use SortableJS
onAudioLyricChange function(lineNum, currentLyric) - audio lyric change handle
getContainer () => HTMLElement | Selectors document.body Return the mount node for Music player
getAudioInstance (instance: HTMLAudioElement) => void - get origin audio element instance , you can use it do everything
autoHiddenCover boolean false Auto hide the cover photo if no cover photo is available
onBeforeAudioDownload (audioInfo: ReactJkMusicPlayerAudioInfo) => Promise - transform download audio info before
clearPriorAudioLists boolean false Replace a new playlist with the first loaded playlist and reset playIndex to 0
autoPlayInitLoadPlayList boolean false Play your new play list right after your new play list is loaded turn false.
spaceBar boolean false Play and pause audio through space bar (Desktop effective).
showDestroy boolean false Destroy player button display
onBeforeDestroy function(currentPlayId,audioLists,audioInfo) - custom destroy handler before
onDestroyed function(currentPlayId,audioLists,audioInfo) - player destroyed handle
customDownloader function(downloadInfo: TransformedDownloadAudioInfo) - custom download handle
onCoverClick function(mode,audioLists,audioInfo) - audio cover clicked handle
onPlayIndexChange function(playIndex) - audio play index change handle
quietUpdate boolean false Detail
renderAudioTitle (audioInfo, isMobile) => ReactNode - use locale.audioTitle to set audio tag title, the api can render custom jsx element for display
mobileMediaQuery string (max-width: 768px) and (orientation : portrait) custom mobile media query string, eg use the mobile version UI on iPad.
volumeFade { fadeIn: number(ms), fadeOut: number(ms) } - audio fade in and out. Detail
sortableOptions object {swap: true, animation: 100, swapClass: 'audio-lists-panel-sortable-highlight-bg'} SortableJs Options
restartCurrentOnPrev boolean false Restarts the current track when trying to play previous song, if the current time of the song is more than 1 second

:bulb: Custom operation ui

Support feature:

  • play
  • pause
  • reload
  • change play time
  • change playback rate
  • change volume
  • destroy audio player
  • toggle play
  • clear audio list
  • toggle play
  • play next audio
  • play prev audio
  • play audio by custom play index
  • update play index
  • SortableJS methods
…

:bulb: Glass bg

javascript

:bulb: Custom downloader

Default use downloadjs, you can use any download library

eg. , or use download attribute

javascript
const customDownloader = (downloadInfo) => {
  const link = document.createElement('a')
  link.href = downloadInfo.src // a.mp3
  link.download = downloadInfo.filename || 'test'
  document.body.appendChild(link)
  link.click()
}

;

// use onBeforeAudioDownload
const onBeforeAudioDownload = () => {
  return Promise.resolve({
    src: '1.mp3',
  })
}

const customDownloader = (downloadInfo) => {
  console.log(downloadInfo.src) // 1.mp3
}

;

:bulb: Destroy player

javascript
const onBeforeDestroy = (currentPlayId, audioLists, audioInfo) => {
  return new Promise((resolve, reject) => {
    // your custom validate
    if (window.confirm('Are you confirm destroy the player?')) {
      // if resolve, player destroyed
      resolve()
    } else {
      // if reject, skip.
      reject()
    }
  })
}

const onDestroyed = (currentPlayId, audioLists, audioInfo) => {
  console.log('onDestroyed:', currentPlayId, audioLists, audioInfo)
}

;

:bulb: Media session

javascript
// so

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptaudioaudio-playercd-playercomponent

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架