2.6.0 • Published 6 months ago

aplayer-ts v2.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Wow, such a lovely HTML5 music player

APlayer, but:

  • Bundle size from 58KB to less than 30KB. See this blog post for details;
  • TypeScript interface support;
  • Fixes APlayer#283;
  • ESM import/export with zero dependencies.

The name 'APlayer-ts' might be a bit misleading, well I just modified APlayer for my personal usage years ago and picked a random name :)

Usage

Basic usage:

import APlayer from 'aplayer-ts'
import 'aplayer-ts/src/css/base.css'

const instance = APlayer()
    .init({ /* refer to the original APlayer doc */ })

API difference

Some APIs have been modified to improve tree-shaking and reduce bundle size.

  1. fixed option is removed, use APlayerFixedModePlugin instead.
import APlayer, { APlayerFixedModePlugin } from 'aplayer-ts'
import 'aplayer-ts/src/css/base.css'
import 'aplayer-ts/src/css/fixed.css' // remember to import the css

const instance = APlayer()
    .use(APlayerFixedModePlugin)
    .init({ /* refer to the original APlayer doc */ })
  1. list.add, list.remove and list.clear are by default removed, install their plugins if you want to use:
import APlayer, { addMusicPlugin, removeMusicPlugin, clearMusicPlugin } from 'aplayer-ts'
import 'aplayer-ts/src/css/base.css'

const instance = APlayer()
    .use(addMusicPlugin)
    .use(removeMusicPlugin)
    .init({ /* refer to the original APlayer doc */ })

instance.list.add({ /* new audios here */ })
  1. HLS is by default removed, install APlayerHlsPlugin if you want to use:
import APlayer, { APlayerHlsPlugin } from 'aplayer-ts'
import 'aplayer-ts/src/css/base.css'

const instance = APlayer()
    .use(APlayerHlsPlugin)
    .init({ /* refer to the original APlayer doc */ })

Development

pnpm dev         # start a demo website server
pnpm build       # build the demo website (to view the output size)
2.6.0

6 months ago

2.5.1

6 months ago

2.5.0

6 months ago

2.4.1

1 year ago

2.4.3

1 year ago

2.4.2

1 year ago

2.4.5

1 year ago

2.4.4

1 year ago

2.4.0

1 year ago

2.3.1

1 year ago

2.3.0

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.1.0

1 year ago

1.10.1-10

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.10.1-8

1 year ago

1.10.1-9

1 year ago

1.10.1-4

1 year ago

1.10.1-5

1 year ago

1.10.1-6

1 year ago

1.10.1-7

1 year ago

1.10.1-3

1 year ago

1.10.1-2

1 year ago

1.10.1-0

1 year ago

1.10.1-1

1 year ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago