mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-09 03:46:16 -08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6d2b81d05 | ||
|
|
0896841d23 |
No files matched your search
@@ -1,10 +0,0 @@
|
||||
# See editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
@@ -1,2 +0,0 @@
|
||||
* text=auto
|
||||
*.js text eol=lf
|
||||
@@ -1,3 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
custom: https://paypal.me/harveyzack
|
||||
@@ -1,21 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Report an issue or unexpected behaviour with Artplayer
|
||||
---
|
||||
|
||||
### Expected behaviour
|
||||
|
||||
### Actual behaviour
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
### Environment
|
||||
|
||||
- Browser:
|
||||
- Version:
|
||||
- Operating System:
|
||||
- Version:
|
||||
|
||||
### Console errors (if any)
|
||||
|
||||
### Link to where the bug is happening
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
name: New feature
|
||||
about: Request new functionality
|
||||
---
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
name: Improvement
|
||||
about: Request a change that isn't a bug or new feature
|
||||
---
|
||||
@@ -1 +0,0 @@
|
||||
PLEASE USE OUR SPECIFIC ISSUE TEMPLATES for bug reports, features and improvement suggestions.
|
||||
@@ -1,43 +0,0 @@
|
||||
name: Node CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [20.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: install, lint, build, and test
|
||||
run: |
|
||||
yarn
|
||||
yarn test:playback
|
||||
yarn lint
|
||||
yarn build:all
|
||||
yarn test:dash-control
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
if: success()
|
||||
run: |
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git add -f docs
|
||||
git commit -m 'Deploy to GitHub Pages'
|
||||
git subtree split --prefix docs master -b gh-pages-temp
|
||||
git push origin gh-pages-temp:refs/heads/gh-pages --force
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,7 +0,0 @@
|
||||
.env
|
||||
.vscode
|
||||
.DS_Store
|
||||
node_modules
|
||||
package-lock.json
|
||||
lerna-debug.log
|
||||
yarn.lock
|
||||
File renamed without changes.
@@ -1,287 +0,0 @@
|
||||
# AGENTS.md
|
||||
|
||||
## Project Summary
|
||||
|
||||
ArtPlayer is a monorepo for a modern HTML5 video player and its ecosystem packages.
|
||||
|
||||
- Homepage: `https://artplayer.org`
|
||||
- Local dev site: `http://localhost:8082`
|
||||
- API docs: `https://artplayer.org/document`
|
||||
- Packaging model: workspace monorepo with per-package versioning and per-package build output
|
||||
|
||||
The repository contains:
|
||||
|
||||
- `packages/artplayer`: the core player
|
||||
- `packages/artplayer-plugin-*`: UI and playback plugins
|
||||
- `packages/artplayer-proxy-*`: proxy renderers and playback adapters
|
||||
- `packages/artplayer-tool-*`: helper tools
|
||||
- `packages/artplayer-vitepress`: docs site package
|
||||
- `docs/`: local demo site, examples, compiled assets, generated docs
|
||||
- `scripts/`: custom build/dev/doc tooling
|
||||
|
||||
## Working Style For This Repo
|
||||
|
||||
- Verify the real implementation before editing docs or examples.
|
||||
- Prefer changing the source package first, then regenerate build artifacts only when needed.
|
||||
- Keep package APIs small and consistent with existing ArtPlayer plugin conventions.
|
||||
- Preserve the existing visual and API style of sibling packages instead of inventing a new pattern.
|
||||
- When touching demo examples, make sure the example still works in `http://localhost:8082`.
|
||||
- Do not hand-edit `dist/`, `docs/compiled/`, or `docs/uncompiled/` unless a build step generated them.
|
||||
|
||||
## Primary Commands
|
||||
|
||||
Use the repo scripts rather than ad hoc bundler commands.
|
||||
|
||||
### Development
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Starts the local dev site on port `8082` and interactively selects a package to watch. The selected package is built into:
|
||||
|
||||
- `docs/uncompiled/<package>/`
|
||||
|
||||
### Production Build
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
Interactive build for one package. Outputs:
|
||||
|
||||
- `packages/<name>/dist/*.js|*.legacy.js|*.mjs`
|
||||
- copied artifacts into `docs/compiled/`
|
||||
|
||||
Build all packages:
|
||||
|
||||
```bash
|
||||
npm run build all
|
||||
```
|
||||
|
||||
### Other Project Scripts
|
||||
|
||||
```bash
|
||||
npm run build:i18n
|
||||
npm run build:ts
|
||||
npm run build:docs
|
||||
npm run build:llm
|
||||
npm run build:test
|
||||
npm run lint
|
||||
npm run build:all
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- `npm run lint` targets package source/types plus scripts and TypeScript demo assets.
|
||||
- `npm run build:all` is expensive; use it when a change truly spans builds/docs/types/lint together.
|
||||
|
||||
## Useful Local URLs
|
||||
|
||||
- Root demo index: `http://localhost:8082`
|
||||
- Demo by package/example:
|
||||
- `http://localhost:8082/?libs=./uncompiled/<package>/index.js&example=<example>`
|
||||
- Docs: `http://localhost:8082/document/`
|
||||
|
||||
For proxy/plugin work, prefer validating on the local demo page rather than reasoning only from source.
|
||||
|
||||
## Repository Layout
|
||||
|
||||
### Core package
|
||||
|
||||
- `packages/artplayer/src/index.js`: player entry
|
||||
- `packages/artplayer/src/player/`: playback mixins and player-facing behavior
|
||||
- `packages/artplayer/src/control/`: bottom controls
|
||||
- `packages/artplayer/src/setting/`: settings panel
|
||||
- `packages/artplayer/src/contextmenu/`: context menu items
|
||||
- `packages/artplayer/src/plugins/`: built-in plugins
|
||||
- `packages/artplayer/src/utils/`: shared helpers, component base classes, DOM utilities
|
||||
- `packages/artplayer/types/`: public TS declarations
|
||||
|
||||
### Ecosystem packages
|
||||
|
||||
Most ecosystem packages follow this pattern:
|
||||
|
||||
```text
|
||||
packages/<package>/
|
||||
src/index.js
|
||||
src/*.less # optional
|
||||
types/*.d.ts # optional but preferred for public APIs
|
||||
README.md
|
||||
package.json
|
||||
dist/*
|
||||
```
|
||||
|
||||
### Demo and docs assets
|
||||
|
||||
- `docs/assets/example/*.js`: runnable browser examples
|
||||
- `docs/assets/ts/*.js`: TypeScript demo assets targeted by lint/docs flows
|
||||
- `docs/uncompiled/`: dev output
|
||||
- `docs/compiled/`: production-copied output
|
||||
- `docs/document/`: generated docs content
|
||||
|
||||
## Architecture Notes
|
||||
|
||||
### Core player
|
||||
|
||||
ArtPlayer composes many subsystems during construction. Common integration points:
|
||||
|
||||
- `art.template`
|
||||
- `art.events`
|
||||
- `art.controls`
|
||||
- `art.setting`
|
||||
- `art.contextmenu`
|
||||
- `art.layers`
|
||||
- `art.plugins`
|
||||
- `art.player`
|
||||
|
||||
When extending behavior, prefer integrating with these existing systems rather than bypassing them.
|
||||
|
||||
### Control and setting components
|
||||
|
||||
Controls and setting entries are managed through component registries.
|
||||
|
||||
Relevant implementation:
|
||||
|
||||
- `packages/artplayer/src/control/index.js`
|
||||
- `packages/artplayer/src/setting/index.js`
|
||||
- `packages/artplayer/src/utils/component.js`
|
||||
|
||||
Important behavior:
|
||||
|
||||
- `art.controls.update(...)` and `art.setting.update(...)` replace existing entries by `name`
|
||||
- `art.controls.remove(name)` and `art.setting.remove(name)` are the correct cleanup APIs
|
||||
- selector-style controls rely on `default` flags to determine highlighted items
|
||||
|
||||
If a plugin conditionally shows UI, it must also clean that UI up when the condition no longer holds.
|
||||
|
||||
### Plugin shape
|
||||
|
||||
Standard plugin/export shape:
|
||||
|
||||
```js
|
||||
export default function somePlugin(option = {}) {
|
||||
return (art) => {
|
||||
return {
|
||||
name: 'somePlugin',
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Naming conventions:
|
||||
|
||||
- package: `artplayer-plugin-<name>`
|
||||
- global: `artplayerPlugin<Name>`
|
||||
- exported function name should match the global naming convention
|
||||
|
||||
### Proxy packages
|
||||
|
||||
Proxy packages usually return a non-video element or video-like shim and emulate media element behavior for ArtPlayer.
|
||||
|
||||
Examples:
|
||||
|
||||
- `packages/artplayer-proxy-canvas`
|
||||
- `packages/artplayer-proxy-mediabunny`
|
||||
|
||||
When editing proxy packages:
|
||||
|
||||
- keep the HTMLMediaElement-like surface coherent
|
||||
- keep event ordering stable
|
||||
- treat `loadedmetadata`, `loadeddata`, `canplay`, `seeked`, `waiting`, and `pause/play` semantics carefully
|
||||
- ensure UI state is updated and cleaned up when source topology changes
|
||||
|
||||
### HLS / adaptive playback controls
|
||||
|
||||
The reference implementation for adaptive selector UI is:
|
||||
|
||||
- `packages/artplayer-plugin-hls-control/src/index.js`
|
||||
|
||||
If adding HLS-like quality/audio selection elsewhere:
|
||||
|
||||
- follow the selector format used there
|
||||
- derive highlighted items from actual current tracks, not only from mode flags
|
||||
- avoid stale selectors when changing to streams without the same topology
|
||||
|
||||
## Build and Artifact Rules
|
||||
|
||||
- Always edit `src/` and `types/` first.
|
||||
- Rebuild package artifacts after source changes that should ship.
|
||||
- Do not treat `dist/` as source of truth.
|
||||
- If a change affects demo behavior, also verify the matching file in `docs/assets/example/`.
|
||||
|
||||
For package-specific builds, the normal flow is:
|
||||
|
||||
1. `npm run dev` and pick the package for fast local iteration
|
||||
2. validate in `http://localhost:8082`
|
||||
3. `npm run build` and pick the package when ready to update shippable artifacts
|
||||
|
||||
## Documentation Expectations
|
||||
|
||||
If a public package API changes, check whether these also need updates:
|
||||
|
||||
- the package `README.md`
|
||||
- `docs/assets/example/<name>.js`
|
||||
- `types/<name>.d.ts`
|
||||
- any generated compiled outputs if you built the package
|
||||
|
||||
Keep examples realistic and runnable. Prefer local demo URLs or stable public sample streams.
|
||||
|
||||
## Code Quality Expectations
|
||||
|
||||
- Follow existing plain JavaScript style in the repo.
|
||||
- Use ASCII unless a file already requires otherwise.
|
||||
- Match the minimal-comment style of neighboring files.
|
||||
- Avoid unnecessary abstraction; this codebase generally prefers direct implementation.
|
||||
- Respect current browser targets:
|
||||
- modern build: `es2020`
|
||||
- legacy build: `es2015`
|
||||
|
||||
## Validation Checklist
|
||||
|
||||
For most package changes, validate as many of these as apply:
|
||||
|
||||
- source file lint passes
|
||||
- local demo page loads
|
||||
- expected events fire once and in the correct order
|
||||
- controls/settings render correctly
|
||||
- cleanup works after restart, source switch, or destroy
|
||||
- package build succeeds
|
||||
|
||||
For playback/proxy changes specifically:
|
||||
|
||||
- test initial load
|
||||
- test play/pause
|
||||
- test seek
|
||||
- test switching source or track topology
|
||||
- test whether UI reflects the actual selected track/quality
|
||||
|
||||
## Notes Specific To `artplayer-proxy-mediabunny`
|
||||
|
||||
This package now depends on modern `mediabunny` and supports HLS through `mediabunny` input handling.
|
||||
|
||||
Files to understand first:
|
||||
|
||||
- `packages/artplayer-proxy-mediabunny/src/index.js`
|
||||
- `packages/artplayer-proxy-mediabunny/src/VideoShim.js`
|
||||
- `packages/artplayer-proxy-mediabunny/src/MediaBunnyEngine.js`
|
||||
- `packages/artplayer-proxy-mediabunny/src/input.js`
|
||||
- `packages/artplayer-proxy-mediabunny/src/m3u8.js`
|
||||
|
||||
Key expectations:
|
||||
|
||||
- HLS source detection should happen in `input.js`
|
||||
- track selection should use actual pairable audio/video relationships
|
||||
- selector UI should mirror the behavior of `artplayer-plugin-hls-control`
|
||||
- selector cleanup is required when a later source no longer supports the same controls
|
||||
- avoid duplicate readiness events during load and track switches
|
||||
|
||||
## When Unsure
|
||||
|
||||
Start with the nearest sibling implementation instead of inventing a new pattern:
|
||||
|
||||
- control/setting UI: `artplayer-plugin-hls-control`, `artplayer-plugin-dash-control`
|
||||
- proxy behavior: `artplayer-proxy-canvas`, `artplayer-proxy-mediabunny`
|
||||
- component lifecycle: `packages/artplayer/src/utils/component.js`
|
||||
|
||||
If a change spans source, examples, and packaging, make all three consistent in the same pass.
|
||||
-435
@@ -1,435 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Fix safe area issue when enter web fullscreen [#1033](https://github.com/zhw2590582/ArtPlayer/issues/1033)
|
||||
|
||||
## [5.4.0] - 2026-03-12
|
||||
|
||||
- Refactor `Parcel` to `Vite`
|
||||
- Change `Artplayer.FULLSCREEN_WEB_IN_BODY` defaults to `true`
|
||||
- The `reset` method is used to reset video request
|
||||
- Fix [#1014](https://github.com/zhw2590582/ArtPlayer/issues/1014)
|
||||
- Fix [#1023](https://github.com/zhw2590582/ArtPlayer/issues/1023)
|
||||
- Fix [#1028](https://github.com/zhw2590582/ArtPlayer/issues/1028)
|
||||
- Add `artplayer-plugin-jassub` plugin
|
||||
- Add `artplayer-proxy-mediabunny` plugin
|
||||
- Add `artplayer-plugin-audio-track` plugin
|
||||
- Add `artplayer-plugin-asr` plugin
|
||||
- Add `artplayer-plugin-danmuku-mask` plugin
|
||||
- Deprecate `artplayer-plugin-libass` plugin
|
||||
- Prevent `Hint.css` from polluting global styles
|
||||
|
||||
## [5.3.0] - 2025-09-06
|
||||
|
||||
- Rename `.esm.js` to `.mjs`
|
||||
- Remove the default `fill` color value of `svg`
|
||||
- Optimize the `autoOrientation` logic
|
||||
- Add `Artplayer.REMOVE_SRC_WHEN_DESTROY`
|
||||
- Add `artplayer-plugin-document-pip` plugin
|
||||
- Add `art.events.bindGlobalEvents` method for rebinding global methods
|
||||
- Optimize `artplayer.d.ts`, now you can directly import `Option`
|
||||
|
||||
```ts
|
||||
import type { Option } from 'artplayer'
|
||||
|
||||
const option: Option = {
|
||||
container: '.artplayer-app',
|
||||
url: './assets/sample/video.mp4',
|
||||
}
|
||||
```
|
||||
|
||||
- Simplify `i18n` import
|
||||
|
||||
```ts
|
||||
import fr from 'artplayer/i18n/fr'
|
||||
import id from 'artplayer/i18n/id'
|
||||
|
||||
const option = {
|
||||
container: '.artplayer-app',
|
||||
url: './assets/sample/video.mp4',
|
||||
i18n: { id, fr },
|
||||
lang: 'fr',
|
||||
}
|
||||
```
|
||||
|
||||
## [5.2.5] - 2025-08-01
|
||||
|
||||
- Add `ESM` version for all packages, such as `artplayer/dist/artplayer.esm.js`
|
||||
- Recognize `globalThis.CUSTOM_USER_AGENT` global variable for customizing `navigator.userAgent`
|
||||
- Fix missing `mount` parameter when initializing `artplayer-plugin-danmuku`
|
||||
|
||||
## [5.2.3] - 2025-04-20
|
||||
|
||||
- Add Vietnamese `vi`
|
||||
- Clear the `video.src` property on destroy
|
||||
- Add `onClick` option for `Setting`
|
||||
- Fix style loading failure of danmuku and chapter plugins when the page has no head tag
|
||||
- Add `gesture` option to enable or disable gesture events on mobile `video` element
|
||||
|
||||
## [5.2.2] - 2025-01-19
|
||||
|
||||
- Fix thumbnail crossover issue
|
||||
- Fix style loading failure when the page has no head tag
|
||||
- Add slider support in subtitle plugin settings panel for mobile dragging
|
||||
- Fix positioning error of settings panel when rotating screen
|
||||
- Fix classname switching error when fullscreen state changes
|
||||
|
||||
## [5.2.1] - 2024-10-26
|
||||
|
||||
- Refactor `Setting` component, fix state loss issue
|
||||
- For `Setting` of type `range`, callback now returns an array of numbers instead of a single number
|
||||
- Remove `isStringOrNumber` utility function
|
||||
- Fix inconsistent state issue in `artplayer-plugin-hls-control`
|
||||
- Deprecate `artplayer-plugin-dash-quality` plugin
|
||||
- Add new `artplayer-plugin-dash-control` plugin
|
||||
- Use `code` instead of deprecated `keyCode` for keyboard events
|
||||
- Add `keydown` event to listen for `keydown` from `document`
|
||||
|
||||
## [5.2.0] - 2024-10-19
|
||||
|
||||
- Add `option.proxy` for proxying third-party `video` and `canvas`
|
||||
- Add `artplayer-proxy-canvas` proxy, enabling video playback via `canvas`
|
||||
- Add `option.thumbnails.scale` for preview image scaling
|
||||
- Fix bug where changing `art.url` didn’t trigger `autoPlayback`: [#797](https://github.com/zhw2590582/ArtPlayer/issues/797)
|
||||
- Add `art.subtitle.cues` property for retrieving all subtitle list
|
||||
- Add `art.subtitle.activeCues` property for retrieving active subtitles
|
||||
- Add `subtitleBeforeUpdate` event triggered before subtitle element rendering
|
||||
- Change `subtitleUpdate` event to `subtitleAfterUpdate`, triggered after subtitle element rendering
|
||||
- Optimize trigger timing and callback parameters of `subtitleLoad` event
|
||||
- Remove `subtitleSwitch` event; use `subtitleLoad` instead
|
||||
- Upgrade `artplayer-plugin-hls-quality` to `artplayer-plugin-hls-control`
|
||||
- Add `artplayer-plugin-ambilight` plugin
|
||||
- Fix `thumbnails` display bug
|
||||
|
||||
## [5.1.7] - 2024-08-15
|
||||
|
||||
- Add `Artplayer.STYLE` property to return player style text
|
||||
- `art.screenshot('your-name')` now supports custom file names
|
||||
- When `Artplayer.CONTEXTMENU` is `false`, default context menu is no longer hidden
|
||||
- Add `art.thumbnails` property for dynamically setting `thumbnails`
|
||||
|
||||
## [5.1.6] - 2024-06-15
|
||||
|
||||
- Optimize `setBar` event
|
||||
- Add `artplayerPluginChapter` plugin
|
||||
- Add `art.plugins.artplayerPluginDanmuku.load(target)` parameter for appending danmuku library
|
||||
- Add `width` option to danmuku plugin; when player width is smaller than this, danmuku sender is placed at the bottom
|
||||
- Fix `artplayerPluginVttThumbnail` not displaying on mobile
|
||||
- Fix danmuku plugin style and percentage font-size bug
|
||||
- `thumbnails` are now visible on mobile too
|
||||
- Restore `screen.orientation.lock` functionality
|
||||
|
||||
## [5.1.5] - 2024-06-01
|
||||
|
||||
- Refactor `artplayerPluginDanmuku` plugin
|
||||
- Add `artplayerPluginChromecast` plugin
|
||||
- Add `fullscreenError` event
|
||||
- Optimize double-click event: [#728](https://github.com/zhw2590582/ArtPlayer/pull/728)
|
||||
- Fix delayed display of `thumbnails`
|
||||
- Add `art.plugins.lock.state = true/false` for manually controlling `lock` state
|
||||
- Control bar no longer auto-hides when mouse is on it or when settings panel is open
|
||||
- Remove `screen.orientation.lock` due to compatibility issues
|
||||
- Fix `fullscreen` bug on mobile
|
||||
|
||||
## [5.1.1] - 2024-01-11
|
||||
|
||||
- Plugin functions now support both synchronous and asynchronous returns
|
||||
|
||||
## [5.1.0] - 2023-12-23
|
||||
|
||||
- Plugin functions now support async return
|
||||
- Player will no longer be destroyed after reaching error limit for playback address
|
||||
- Split language files, core no longer bundles multiple languages [Language Settings](https://artplayer.org/document/start/i18n.html)
|
||||
- Updating components now supports updating only specified fields [pull/549](https://github.com/zhw2590582/ArtPlayer/pull/549)
|
||||
- Add `muted` event triggered when mute state changes
|
||||
- Add `Artplayer.LOG_VERSION` global config to control whether to print player version (default `true`)
|
||||
- Add `Artplayer.USE_RAF` global config to control whether to use `requestAnimationFrame` (default `false`), currently for smooth progress bar effect
|
||||
- Remove default styles `margin:0;padding:0;` to avoid conflicts with third-party libraries
|
||||
- Subtitle line changed from `p` to `div` tag, with classname `art-subtitle-line`
|
||||
- On mobile, tapping video toggles control bar display
|
||||
- Remove `art.loop` interval playback feature (not commonly used)
|
||||
- Subtitle track now has `label` attribute to display subtitle names on mobile
|
||||
- Add utility functions `unescape`, `isBrowser`, `setStyleText`
|
||||
- Add `artplayerPluginMultipleSubtitles` plugin for merged subtitle files: [demo](https://www.artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles)
|
||||
- Modify mini progress bar display
|
||||
|
||||
## [5.0.9] - 2023-05-14
|
||||
|
||||
- Fix `art.autoOrientation` style bug
|
||||
- Remove animation effect of player container
|
||||
|
||||
## [5.0.8] - 2023-05-13
|
||||
|
||||
- Fix conflict of `art.mini`
|
||||
- Fix animation bug of `art.aspectRatio`
|
||||
|
||||
## [5.0.7] - 2023-05-13
|
||||
|
||||
- Switching via `switchUrl` or `switchQuality` preserves existing adjustments such as `aspectRatio`, `playbackRate`, `flip`, `autoSize`
|
||||
- Remove the second `name` parameter from `switchUrl` and `switchQuality`
|
||||
- Add `isIOS13` utility to fix inaccurate `isMobile` detection on iOS 13+
|
||||
- `art.autoSize` and `art.autoHeight` are now methods: `art.autoSize()` and `art.autoHeight()`
|
||||
- Add new property `art.quality` for dynamically updating quality list
|
||||
- Fix incorrect `art.aspectRatio` property
|
||||
- Add `art.switch` setter property, same as `art.switchUrl` method
|
||||
|
||||
## [5.0.6] - 2023-05-03
|
||||
|
||||
- Fix style bug of settings panel
|
||||
|
||||
## [5.0.5] - 2023-05-03
|
||||
|
||||
- Add `heatmap` option to danmuku plugin for enabling heatmap (default: off)
|
||||
- Fix English subtitle line break style bug
|
||||
- Fix settings panel style bug
|
||||
- Remove unnecessary global properties
|
||||
- Remove `title` option (not useful now)
|
||||
- Remove `whitelist` option (not useful now)
|
||||
|
||||
## [5.0.4] - 2023-04-27
|
||||
|
||||
- Fix controller dropdown list style bug
|
||||
|
||||
## [5.0.3] - 2023-04-26
|
||||
|
||||
- Fix `event.pageY` value error in volume controller
|
||||
- Update build config, `artplayer.legacy.js` now compatible with IE 11
|
||||
|
||||
## [5.0.2] - 2023-04-24
|
||||
|
||||
- Fix style compatibility issue of control bar position
|
||||
|
||||
## [5.0.1] - 2023-04-24
|
||||
|
||||
- Fix web fullscreen style bug
|
||||
- Fix built-in settings text error
|
||||
|
||||
## [5.0.0] - 2023-04-23
|
||||
|
||||
- Rewrite volume controller
|
||||
- Fix incorrect progress drag angle on mobile
|
||||
- Rewrite `mini` mode, now video detaches from original container
|
||||
- All components (layers, controller, contextmenu, settings panel) support dynamic deletion and updating
|
||||
- Subtitle option adds `onVttLoad` for modifying vtt text before output
|
||||
- Rewrite all styles, add many `css` variables
|
||||
- Add `cssVar` option for initializing `css` variables
|
||||
- Add `cssVar` method for getting/setting `css` variables
|
||||
- `artplayer-plugin-hls-quality` adds `getResolution` function option for getting resolution text from level
|
||||
- Add `artplayer-plugin-dash-quality` plugin for adding Dash quality list to player
|
||||
- Fix `lock` and `loop` event issues
|
||||
- Add Russian `ru` and Indonesian `id` languages
|
||||
- Update `artplayer-plugin-control` for `artplayer@5.0.0`
|
||||
- Update `artplayer-plugin-dash-quality` for `artplayer@5.0.0`
|
||||
- Update `artplayer-plugin-hls-quality` for `artplayer@5.0.0`
|
||||
- Update `artplayer-plugin-danmuku` for `artplayer@5.0.0`
|
||||
|
||||
## [4.6.2] - 2023-01-26
|
||||
|
||||
- Default `Artplayer.PROGRESS_HEIGHT` changed to `6`
|
||||
- Add `artplayer-plugin-vtt-thumbnail` to generate video preview images from vtt subtitle files
|
||||
- Add `Artplayer.FULLSCREEN_WEB_IN_BODY` for whether to mount player to `document.body` in web fullscreen (default `false`)
|
||||
- Change subtitle offset adjustment to slider
|
||||
- Subtitle option adds `escape` (default `true`) for HTML escaping
|
||||
|
||||
## [4.6.1] - 2023-01-11
|
||||
|
||||
- Write brand new docs
|
||||
- Optimize `d.ts`
|
||||
- Remove redundant events
|
||||
- Optimize some styles
|
||||
- Add `i18n` option
|
||||
|
||||
## [4.6.0] - 2022-12-31
|
||||
|
||||
- Optimize style effects of control bar icons
|
||||
- Optimize style effects of settings panel
|
||||
- Fix incorrect `art.fullscreen` state detection
|
||||
- Add `artplayer-plugin-control` plugin to change control bar style
|
||||
|
||||
## [4.5.12] - 2022-11-20
|
||||
|
||||
- Fix `art.loop = []` display bug
|
||||
|
||||
## [4.5.11] - 2022-11-06
|
||||
|
||||
- Add `Artplayer.CONTEXTMENU` for controlling whether to show contextmenu (default `true`)
|
||||
- Whitelist function default `true` on mobile, all devices use player UI
|
||||
|
||||
## [4.5.10] - 2022-11-05
|
||||
|
||||
- Fix subtitle not showing in Firefox: [#pull/415](https://github.com/zhw2590582/ArtPlayer/pull/415)
|
||||
- Info popup supports clicking to select video property text
|
||||
|
||||
## [4.5.9] - 2022-11-05
|
||||
|
||||
- Add `art.type` property to get/set video type
|
||||
- Add `art.video` property to get video element
|
||||
- Add `artplayer-tool-iframe` plugin to control player inside iframe
|
||||
- Add `artplayer-plugin-hls-quality` plugin for adding Hls quality list
|
||||
- Add `Artplayer.PLAYBACK_RATE` for default playback rates `[0.5, 0.75, 1, 1.25, 1.5, 2]`
|
||||
- Add `Artplayer.ASPECT_RATIO` for default ratios `['default','4:3','16:9']`
|
||||
- Add `Artplayer.FLIP` for default flip options `['normal','horizontal','vertical']`
|
||||
- Add `Artplayer.PROGRESS_HEIGHT` (default: `4`)
|
||||
- Add `legacy.js` version for older browsers (larger size)
|
||||
- Remove `examples` dir, no longer provide Vue/React examples
|
||||
|
||||
## [4.5.8] - 2022-10-09
|
||||
|
||||
- Add Farsi language
|
||||
- Add `Artplayer.DEBUG` (default `false`) for debug logs
|
||||
- Add `art.setting.update()` for dynamic settings update
|
||||
- Optimize `artplayer.d.ts`
|
||||
|
||||
## [4.5.7] - 2022-09-28
|
||||
|
||||
- Add `Artplayer.VOLUME_STEP` for controlling volume step (default `0.1`)
|
||||
- Add `Artplayer.SEEK_STEP` for controlling seek step (default `5s`)
|
||||
- Fix some svg icons not showing on mobile
|
||||
- Fix desktop progress bar cannot click+drag simultaneously
|
||||
- Fix mobile progress bar cannot click+drag
|
||||
- Add `art.isRotate` property for detecting auto fullscreen rotation
|
||||
- Settings panel `range` adds `onChange` option for real-time values
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
setting: true,
|
||||
settings: [
|
||||
{
|
||||
html: 'Slider',
|
||||
tooltip: '5x',
|
||||
range: [5, 1, 10, 0.1],
|
||||
onChange: function (item) {
|
||||
return item.range + 'x';
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## [4.5.6] - 2022-09-19
|
||||
|
||||
- Fix hls.js not working in Safari
|
||||
|
||||
## [4.5.5] - 2022-09-19
|
||||
|
||||
- Ad plugin adds `option.muted` for autoplay muted ads
|
||||
- Danmuku plugin exposes `art.plugins.artplayerPluginDanmuku.reset()` to clear display
|
||||
- Danmuku plugin exposes `art.plugins.artplayerPluginDanmuku.option` for current config
|
||||
- Fix subtitle bug in iOS fullscreen
|
||||
- Add Spanish `es`
|
||||
|
||||
## [4.5.4] - 2022-08-01
|
||||
|
||||
### Added
|
||||
|
||||
- Add `Artplayer.AUTO_PLAYBACK_MIN` for min playback memory value (default `5s`)
|
||||
- Add `Artplayer.TOUCH_MOVE_RATIO` for mobile progress drag ratio (default `0.5`)
|
||||
- `option.thumbnails` adds optional `width`/`height`
|
||||
- Add `option.id` for unique playback memory identifier
|
||||
|
||||
## [4.5.3] - 2022-07-13
|
||||
|
||||
### Added
|
||||
|
||||
- `url` option allows empty string for async `art.url`
|
||||
|
||||
```js
|
||||
const art = new Artplayer({
|
||||
url: '',
|
||||
container: '.artplayer-app',
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
art.url = '/assets/sample/video.mp4';
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
- `art.play()` always returns Promise; `play` event is async
|
||||
|
||||
```js
|
||||
const art = new Artplayer({
|
||||
url: '/assets/sample/video.mp4',
|
||||
container: '.artplayer-app',
|
||||
});
|
||||
|
||||
art.on('ready', async () => {
|
||||
try {
|
||||
await art.play();
|
||||
console.log('Play success');
|
||||
} catch (error) {
|
||||
console.log('Play failed', error.message);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
- Add `airplay` (only Safari)
|
||||
|
||||
```js
|
||||
const art = new Artplayer({
|
||||
url: '/assets/sample/video.mp4',
|
||||
container: '.artplayer-app',
|
||||
airplay: true,
|
||||
});
|
||||
```
|
||||
|
||||
## [4.5.2] - 2022-06-22
|
||||
|
||||
- Optimize auto-playback to allow user choice
|
||||
|
||||
## [4.5.0] - 2022-06-21
|
||||
|
||||
- Remove built-in ads
|
||||
- Add ad plugin
|
||||
|
||||
## [4.4.7] - 2022-06-13
|
||||
|
||||
- Support danmuku lib d.ts
|
||||
- Update deps
|
||||
|
||||
## [4.4.6] - 2022-06-11
|
||||
|
||||
- Add danmuku lib d.ts
|
||||
- Adjust subtitle font-size param
|
||||
- Optimize regex parsing of xml danmuku
|
||||
|
||||
## [4.4.5] - 2022-06-02
|
||||
|
||||
- Fix theme color missing in mini mode
|
||||
|
||||
## [4.4.3] - 2022-05-26
|
||||
|
||||
- Fix custom mounted input residual on danmuku destroy
|
||||
- Fix mini mode size calculation error
|
||||
|
||||
## [4.4.2] - 2022-05-20
|
||||
|
||||
- Remove UI init `video:loadedmetadata` event
|
||||
- Danmuku exposes `load` for switching sources
|
||||
- Add error icon after video load error limit
|
||||
- Fix multiple init of setting panel bug
|
||||
|
||||
## [4.4.1] - 2022-05-17
|
||||
|
||||
- Add `art.isInput`, when true control bar won’t auto-hide (e.g. typing danmuku)
|
||||
- Add `art.isLock`, when true on mobile prevents seek/play/pause
|
||||
- Fix fixed width bug of danmuku input box
|
||||
- Settings panel supports `range` and `onRange`
|
||||
- Add `isAndroid` and `isIOS` utils
|
||||
- Danmuku adds `lockTime`, `maxLength`, `minWidth`, `maxWidth`, `mount`, `beforeEmit`, `theme`
|
||||
|
||||
## [4.4.0] - 2022-05-15
|
||||
|
||||
- Settings panel supports `switch` and `onSwitch`
|
||||
- Danmuku plugin adds settings panel and send
|
||||
- Danmuku adds default mode and font-size
|
||||
- Danmuku font-size supports percentage of player
|
||||
- Fix flip icon missing
|
||||
- Player with focus won’t auto-hide control bar
|
||||
- Remove subtitle toggle button (manual config required)
|
||||
@@ -1,202 +0,0 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
ArtPlayer.js is a modern, full-featured HTML5 video player. It's organized as a monorepo using Lerna with independent versioning.
|
||||
|
||||
- **Homepage**: https://artplayer.org
|
||||
- **Online Editor**: https://artplayer.org (for testing examples)
|
||||
- **API Docs**: https://artplayer.org/document
|
||||
|
||||
## Repository Structure
|
||||
|
||||
```
|
||||
packages/
|
||||
artplayer/ # Core player package
|
||||
artplayer-plugin-*/ # 17+ plugins (danmuku, ads, chromecast, etc.)
|
||||
artplayer-proxy-*/ # Canvas, Mediabunny proxies
|
||||
artplayer-tool-*/ # iframe, thumbnail tools
|
||||
artplayer-vitepress/ # Documentation site
|
||||
|
||||
docs/ # Documentation and demo site
|
||||
assets/ # Example assets and TypeScript demos
|
||||
compiled/ # Built packages output
|
||||
document/ # Generated API documentation
|
||||
uncompiled/ # Development build output
|
||||
test/ # Browser test files
|
||||
|
||||
scripts/ # Build tooling
|
||||
build.js # Production build
|
||||
dev.js # Development server
|
||||
build-i18n.js # I18n bundle builder
|
||||
build-docs.js # Documentation generator
|
||||
build-llm.js # LLMs.txt generator
|
||||
plugin/create.js # New plugin scaffolding
|
||||
```
|
||||
|
||||
## Common Commands
|
||||
|
||||
### Development
|
||||
```bash
|
||||
# Start dev server on port 8082 with hot reload
|
||||
npm run dev
|
||||
|
||||
# Build for production (interactive prompt to select package)
|
||||
npm run build
|
||||
|
||||
# Build all packages
|
||||
npm run build all
|
||||
|
||||
# Build everything (packages, i18n, types, docs) + lint
|
||||
npm run build:all
|
||||
```
|
||||
|
||||
### Code Quality
|
||||
```bash
|
||||
# Lint with auto-fix (covers packages, scripts, tests, docs assets)
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Plugin Development
|
||||
```bash
|
||||
# Create new plugin from template
|
||||
npm run create:plugin <kebab-case-name>
|
||||
|
||||
# Example:
|
||||
npm run create:plugin my-feature
|
||||
```
|
||||
|
||||
### I18n
|
||||
```bash
|
||||
# Build i18n bundles for all languages
|
||||
npm run build:i18n
|
||||
```
|
||||
|
||||
### TypeScript
|
||||
```bash
|
||||
# Generate TypeScript declaration files
|
||||
npm run build:ts
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Player (`packages/artplayer`)
|
||||
|
||||
The main `Artplayer` class extends `Emitter` and initializes sub-components:
|
||||
|
||||
```javascript
|
||||
// Key components instantiated in constructor:
|
||||
this.template = new Template(this) // DOM structure
|
||||
this.events = new Events(this) // Event handling
|
||||
this.player = new Player(this) // Video playback
|
||||
this.controls = new Control(this) // Control bar
|
||||
this.layers = new Layer(this) // Custom layers
|
||||
this.contextmenu = new Contextmenu(this)
|
||||
this.subtitle = new Subtitle(this)
|
||||
this.setting = new Setting(this)
|
||||
this.plugins = new Plugins(this) // Plugin manager
|
||||
// ... and more
|
||||
```
|
||||
|
||||
Source organization in `src/`:
|
||||
- `config/` - Default configuration values
|
||||
- `control/` - UI controls (play, progress, volume, etc.)
|
||||
- `events/` - Event handling (click, hover, resize, etc.)
|
||||
- `i18n/` - Localization files
|
||||
- `icons/` - SVG icons
|
||||
- `player/` - Video playback logic (hls, flv, dash, etc.)
|
||||
- `plugins/` - Built-in plugins
|
||||
- `setting/` - Settings panel components
|
||||
- `style/` - LESS stylesheets
|
||||
- `template.js` - HTML template generation
|
||||
- `utils/` - Utility functions
|
||||
|
||||
### Plugin Architecture
|
||||
|
||||
Plugins are functions that receive the player instance and options:
|
||||
|
||||
```javascript
|
||||
// Template from scripts/plugin/template/src/index.js
|
||||
export default function artplayerPluginTemplate(option = {}) {
|
||||
return (art) => {
|
||||
// Plugin initialization
|
||||
// Access: art.player, art.controls, art.template, etc.
|
||||
|
||||
return {
|
||||
name: 'artplayerPluginTemplate',
|
||||
// Expose methods to art.plugins['artplayerPluginTemplate']
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Plugin naming convention:
|
||||
- Package: `artplayer-plugin-<name>`
|
||||
- Global variable: `artplayerPlugin<Name>` (camelCase)
|
||||
- Exported function uses same name as global
|
||||
|
||||
### Styling
|
||||
|
||||
Uses LESS with inline imports:
|
||||
```javascript
|
||||
import style from './style/index.less?inline'
|
||||
```
|
||||
|
||||
Styles are injected at runtime via `utils.setStyleText()`.
|
||||
|
||||
### Build System
|
||||
|
||||
Uses Vite via custom Node.js scripts:
|
||||
|
||||
**Development** (`scripts/dev.js`):
|
||||
- Builds IIFE bundle to `docs/uncompiled/<package>/`
|
||||
- Serves `docs/` directory on port 8082
|
||||
- Watches source files for changes
|
||||
|
||||
**Production** (`scripts/build.js`):
|
||||
- Builds 3 formats: UMD (`.js`), UMD legacy (`.legacy.js`), ESM (`.mjs`)
|
||||
- Outputs to `packages/<name>/dist/`
|
||||
- Copies to `docs/compiled/`
|
||||
|
||||
### I18n System
|
||||
|
||||
Language files in `packages/artplayer/src/i18n/`:
|
||||
- Base language: `zh-cn.js`
|
||||
- Additional languages: `en.js`, `fr.js`, etc.
|
||||
- Built as separate UMD/ESM bundles via `build-i18n.js`
|
||||
- Global naming: `artplayerI18n<Language>` (e.g., `artplayerI18nEn`)
|
||||
|
||||
### Creating New Plugins
|
||||
|
||||
The `npm run create:plugin <name>` command:
|
||||
1. Copies `scripts/plugin/template/` to `packages/artplayer-plugin-<name>/`
|
||||
2. Replaces placeholders in filenames and content
|
||||
3. Creates example file at `docs/assets/example/<name>.js`
|
||||
|
||||
Plugin template structure:
|
||||
```
|
||||
src/
|
||||
index.js # Main plugin code
|
||||
style.less # Plugin styles
|
||||
package.json
|
||||
README.md
|
||||
types/
|
||||
<name>.d.ts # TypeScript declarations (optional)
|
||||
```
|
||||
|
||||
### Utility Functions
|
||||
|
||||
Core utilities in `packages/artplayer/src/utils/`:
|
||||
- `utils.js` - Common helpers (isMobile, isSafari, query, etc.)
|
||||
- `emitter.js` - Event emitter base class
|
||||
- `scheme.js` - Option validation schema
|
||||
|
||||
## Development Notes
|
||||
|
||||
- **Package manager**: Uses Yarn with Lerna
|
||||
- **Node version**: >= 20.0.0
|
||||
- **ESLint**: Uses @antfu/eslint-config
|
||||
- **Browser support**: Last 1 Chrome version (ES2020), legacy builds target ES2015
|
||||
- **UMD builds**: Always expose global even in AMD/RequireJS environments
|
||||
File renamed without changes.
@@ -1,35 +0,0 @@
|
||||
This project uses `vite` as a development and packaging tool, so there are few overall configuration options
|
||||
|
||||
## 1. Install dependencies
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
|
||||
## 2. Develop the project and open the demo page
|
||||
|
||||
```base
|
||||
npm run dev
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
```
|
||||
|
||||
## 3. Package the project
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
```
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Harvey Zhao
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,174 +0,0 @@
|
||||
<h2 align="center">
|
||||
<p><img src="./images/logo.png" width="100" alt="logo"></p>
|
||||
<a href="https://artplayer.org">ArtPlayer.js</a>
|
||||
</h2>
|
||||
|
||||
<p align="center">
|
||||
:art: ArtPlayer.js is a modern and full featured HTML5 video player
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/artplayer">
|
||||
<img src="https://img.shields.io/bundlephobia/minzip/artplayer" alt="Size">
|
||||
<img src="https://img.shields.io/npm/dm/artplayer.svg?sanitize=true" alt="Downloads">
|
||||
<img src="https://img.shields.io/npm/v/artplayer.svg?sanitize=true" alt="Version">
|
||||
<img src="https://img.shields.io/npm/l/artplayer.svg?sanitize=true" alt="License">
|
||||
<img src="https://data.jsdelivr.com/v1/package/npm/artplayer/badge?style=rounded" alt="jsdelivr">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<span>・</span>
|
||||
<a href="https://artplayer.org">Online Editor</a>
|
||||
<span>・</span>
|
||||
<a href="https://artplayer.org/document">API Document</a>
|
||||
<span>・</span>
|
||||
<a href="https://artplayer.org/?libs=./uncompiled/artplayer-plugin-danmuku/index.js&example=danmuku">Danmuku</a>
|
||||
<span>・</span>
|
||||
<a href="./CHANGELOG.md">Changelog</a>
|
||||
<span>・</span>
|
||||
<a href="https://artplayer.org/llms.txt">🤖LLMs</a>
|
||||
<span>・</span>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://artplayer.org">
|
||||
<img src="./images/screenshot.png" alt="screenshot" width="720">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## Home Page
|
||||
|
||||
[https://artplayer.org](https://artplayer.org)
|
||||
|
||||
## Mobile Demo
|
||||
|
||||
<img src="./images/qrcode.png" width="250">
|
||||
|
||||
## Features
|
||||
|
||||
[ArtPlayer.js](https://artplayer.org) is an easy-to-use and feature-rich HTML5 video player, and most of the player's functional controls support customization, which makes it easy to connect with your business logic. In addition, it directly supports `.vtt`, `.ass` and `.srt` subtitle formats. Integration with other dependencies such as `flv.js`, `hls.js`, `dash.js`, etc. is also very simple. The code is highly decoupled, the structure and logic are clear, and it is easy to track errors and add new features.
|
||||
|
||||
## Install
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
```bash
|
||||
$ npm install artplayer
|
||||
```
|
||||
|
||||
Or install with `yarn`:
|
||||
|
||||
```bash
|
||||
$ yarn add artplayer
|
||||
```
|
||||
|
||||
Or install with `pnpm`:
|
||||
|
||||
```bash
|
||||
$ pnpm add artplayer
|
||||
```
|
||||
|
||||
Or install with `bun`:
|
||||
|
||||
```bash
|
||||
$ bun add artplayer
|
||||
```
|
||||
|
||||
```js
|
||||
import Artplayer from 'artplayer'
|
||||
```
|
||||
|
||||
Or umd build also available:
|
||||
|
||||
```html
|
||||
<script src="path/to/artplayer.js"></script>
|
||||
```
|
||||
|
||||
Or from CDN:
|
||||
|
||||
```html
|
||||
<!-- jsdelivr -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js"></script>
|
||||
|
||||
<!-- unpkg -->
|
||||
<script src="https://unpkg.com/artplayer/dist/artplayer.js"></script>
|
||||
```
|
||||
|
||||
Will expose the global variable to `window.Artplayer`.
|
||||
|
||||
## Usage
|
||||
|
||||
```html
|
||||
<div class="artplayer-app"></div>
|
||||
```
|
||||
|
||||
```js
|
||||
let art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: 'path/to/video.mp4',
|
||||
})
|
||||
```
|
||||
|
||||
## Plugins
|
||||
|
||||
| Name | Describe | State |
|
||||
| :--- | :--- | :--- |
|
||||
| [artplayer-plugin-danmuku](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-danmuku/index.js&example=danmuku) | Danmuku (bullet comment) system | <img src="https://img.shields.io/npm/v/artplayer-plugin-danmuku.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-danmuku.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-hls-control](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.5.17/hls.min.js%0A./uncompiled/artplayer-plugin-hls-control/index.js&example=hls.control) | HLS quality control | <img src="https://img.shields.io/npm/v/artplayer-plugin-hls-control.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-hls-control.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-dash-control](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/5.2.1/modern/umd/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-control/index.js&example=dash.control) | DASH quality control | <img src="https://img.shields.io/npm/v/artplayer-plugin-dash-control.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-dash-control.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-vtt-thumbnail](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vtt-thumbnail/index.js&example=vtt.thumbnail) | VTT thumbnail preview | <img src="https://img.shields.io/npm/v/artplayer-plugin-vtt-thumbnail.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-vtt-thumbnail.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-multiple-subtitles](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles) | Multiple subtitles support | <img src="https://img.shields.io/npm/v/artplayer-plugin-multiple-subtitles.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-multiple-subtitles.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-chromecast](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chromecast/index.js&example=chromecast) | Google Chromecast support | <img src="https://img.shields.io/npm/v/artplayer-plugin-chromecast.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-chromecast.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-vast](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast) | VAST/VPAID advertising | <img src="https://img.shields.io/npm/v/artplayer-plugin-vast.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-vast.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-chapter](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chapter/index.js&example=chapter) | Video chapters support | <img src="https://img.shields.io/npm/v/artplayer-plugin-chapter.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-chapter.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-auto-thumbnail](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-auto-thumbnail/index.js&example=auto.thumbnail) | Auto-generated thumbnails | <img src="https://img.shields.io/npm/v/artplayer-plugin-auto-thumbnail.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-auto-thumbnail.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-ambilight](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-ambilight/index.js&example=ambilight) | Ambilight effect | <img src="https://img.shields.io/npm/v/artplayer-plugin-ambilight.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-ambilight.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-document-pip](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-document-pip/index.js&example=document.pip) | Document Picture-in-Picture | <img src="https://img.shields.io/npm/v/artplayer-plugin-document-pip.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-document-pip.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-audio-track](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-audio-track/index.js&example=audio.track) | Independent audio track playback | <img src="https://img.shields.io/npm/v/artplayer-plugin-audio-track.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-audio-track.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-jassub](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-jassub/index.js&example=jassub) | ASS/SSA subtitle support | <img src="https://img.shields.io/npm/v/artplayer-plugin-jassub.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-jassub.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-danmuku-mask](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-danmuku/index.js%0A./uncompiled/artplayer-plugin-danmuku-mask/index.js&example=danmuku.mask) | Danmuku masking (smart blocking) | <img src="https://img.shields.io/npm/v/artplayer-plugin-danmuku-mask.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-danmuku-mask.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-asr](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-asr/index.js&example=asr) | Automatic Speech Recognition | <img src="https://img.shields.io/npm/v/artplayer-plugin-asr.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-plugin-asr.svg?sanitize=true"> |
|
||||
| [artplayer-plugin-ads](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-ads/index.js&example=ads) | Video advertising plugin | WIP |
|
||||
|
||||
## Libraries
|
||||
|
||||
| Name | Describe | State |
|
||||
| :--- | :--- | :--- |
|
||||
| [hls.js](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.5.17/hls.min.js&example=hls) | HLS client | <img src="https://img.shields.io/npm/v/hls.js.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/hls.js.svg?sanitize=true"> |
|
||||
| [dash.js](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/5.2.1/modern/umd/dash.all.min.js&example=dash) | MPEG DASH player | <img src="https://img.shields.io/npm/v/dashjs.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/dashjs.svg?sanitize=true"> |
|
||||
| [flv.js](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/flv.js/1.6.2/flv.min.js&example=flv) | HTML5 FLV Player | <img src="https://img.shields.io/npm/v/flv.js.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/flv.js.svg?sanitize=true"> |
|
||||
| [mpegts.js](https://artplayer.org/?libs=https://cdn.jsdelivr.net/npm/mpegts.js@1.7.3/dist/mpegts.min.js&example=mpegts) | MPEG-TS/FLV Player | <img src="https://img.shields.io/npm/v/mpegts.js.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/mpegts.js.svg?sanitize=true"> |
|
||||
| [webtorrent.js](https://artplayer.org/?libs=https://cdn.jsdelivr.net/npm/webtorrent@1/webtorrent.min.js&example=webtorrent) | Streaming torrent client | <img src="https://img.shields.io/npm/v/webtorrent.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/webtorrent.svg?sanitize=true"> |
|
||||
|
||||
## Proxys
|
||||
|
||||
| Name | Describe | State |
|
||||
| :--- | :--- | :--- |
|
||||
| [Canvas](https://artplayer.org/?libs=./uncompiled/artplayer-proxy-canvas/index.js&example=canvas) | Proxy video to canvas | <img src="https://img.shields.io/npm/v/artplayer-proxy-canvas.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-proxy-canvas.svg?sanitize=true"> |
|
||||
| [Mediabunny](https://artplayer.org/?libs=./uncompiled/artplayer-proxy-mediabunny/index.js&example=mediabunny) | Mediabunny proxy | <img src="https://img.shields.io/npm/v/artplayer-proxy-mediabunny.svg?sanitize=true"><br><img src="https://img.shields.io/npm/dm/artplayer-proxy-mediabunny.svg?sanitize=true"> |
|
||||
|
||||
## Changelog
|
||||
|
||||
[CHANGELOG.md](./CHANGELOG.md)
|
||||
|
||||
## Contributing
|
||||
|
||||
[CONTRIBUTING.md](./CONTRIBUTING.md)
|
||||
|
||||
## Donations
|
||||
|
||||
We accept donations through these channels:
|
||||
|
||||

|
||||
|
||||
- [Patreon](https://www.patreon.com/artplayer)
|
||||
- [Paypal](https://www.paypal.me/harveyzack)
|
||||
|
||||
## QQ Group
|
||||
|
||||

|
||||
|
||||
## License
|
||||
|
||||
MIT © Harvey Zhao
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 1075 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user