百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

react-music-player

> 前端框架
开源

React、TS 的音乐播放插件,支持歌词同步,适配 PC 和移动端;使用 React 和 TypeScript 构建的音乐播放器,适用于移动设备和 PC。

397 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

React、TS 的音乐播放插件,支持歌词同步,适配 PC 和移动端;使用 React 和 TypeScript 构建的音乐播放器,适用于移动设备和 PC。

react-cool-music-player

Responsive audio play assembly adaptive with PC and mobile devices. All icons and texts are customizable. Theme colors can be modified. Synchronized scrolling of lyrics is supported.

Click here to view a demonstration | 中文文档

Functions

Adaptive with PCs and mobile devices. Popup of the play detail page is supported on mobile devices.

  1. Play control
    • Previous song,next song
    • Pause
    • Scroll or click on the progress bar of the song to realize fast forward and fast backward of the music.
    • Scroll the lyrics to locate the play position and implement functions of fast forward and fast backward.
    • Play, delete music in the playlist, and the currently playing music is highlighted.
  2. Volume control
    • Drag, click on the volume control bar to control the volume.
    • Click on the volume icon to switch the mute status.
  3. Status display
    • The cover picture rotates when music is playing and stops rotating when music pauses.
    • Remaining time of the music is displayed.
    • Buffer bar.
    • Play progress bar.
    • Lyrics synchronously scroll and the current lyrics are highlighted.
    • When the volume is 0, the volume icon is displayed as a mute icon.

Usage

install

bash
npm install react-cool-music-player

Use in code

…

API

Audio data structure in the player:

typescript
  interface IAudio {
    /*Audio link*/
    src: string
    /*author*/
    artist: string
    /*audio name*/
    name: string
    /*audio image*/
    img: string
    /*audio ID*/
    id: string
    /*lyrics*/
    lyric?: string
    /*lyric translation*/
    tLyric?: string
    /*disabled or not*/
    disabled?: boolean
    /*reasons for being disabled*/
    disabledReason?: string | React.ReactNode
  }

Complete API list

API Description Type Default
data Audio data introduced into the assembly, which is displayed in the playlist IAudio[] -
play Controls the player to start and stop playing boolean false
playListPlaceholder Placeholder text when the playlist is empty string 'No data'
currentAudio Can control audio of the current player. If it is not introduced, the audio to be played in the player is the first audio in the playlist by default IAudio -
playListShow Facilitates externally controlling display and hiding of the playlist boolean false
showPlayDetail Whether play details are displayed upon click on the song icon (valid on mobile devices) boolean true
playDetailShow Facilitates externally controlling display and hiding of the play details (valid on mobile devices) boolean false
detailBackground Background of the play detail page (valid on mobile devices) React.ReactNode -
volume Volume, which, after being introduced into the assembly, can control the volume size of the player, ranging from 0 to 1 number 0.5
zIndex z-index value of the player number 1000
showLyricNormal Whether to display lyrics on non-mobile devices boolean false
showDetailLyric Whether to display lyrics on the song detail page on mobile devices boolean false
showLyricMini Whether to display mini lyrics on mobile devices boolean false
playMode Play mode, which, after being introduced, can control the play modes of the playlist in the player (play in order, random play, single cycle) order,random,loop order
lyric Introduced lyric data when lyrics are loaded asynchronously string -
tLyric Introduced lyric translation when lyrics are loaded asynchronously if it is needed to display lyric translation string -
lyricLoading Loading status display for loading lyrics asynchronously boolean false
lyricPlaceholder Placeholder element when lyric data is empty React.ReactNode or string false
showProgressControlByLyricScroll Whether it is needed to manually scroll lyrics to adjust the play progress in play details on mobile devices boolean true
avatarPlaceholder Placeholder element of the song icon when the song image is empty React.ReactNode
           |

| actions | An action group displayed in the player on non-mobile devices, between the play mode button and the volume control button | Array React.ReactNode> | [] | | detailActionTopRight | An action element displayed at the upper right corner in the play details on mobile devices | (data: IAudio) => React.ReactNode | - | | detailActionsBottom | An action group displayed above the progress bar in the play details on mobile devices | Array React.ReactNode> | [] | | playListAudioActions | An action group of each piece of audio in the playlist, located on the right side of the song name, displayed in the activated status on a mobile terminal and when a non-mobile devices hovers | Array React.ReactNode> | [] | | playListHeader | Two (left and right) elements on the top of the playlist | { headerLeft?: React.ReactNode or string, headerRight?: React.ReactNode or string } | headerLeft: 'Play list', headerRight: '' | | primaryColor | Theme colors | string

Issues· 23 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptaudio-playerhookshtml5music-player

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

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