feat: update version to 5.1.7 and add custom userAgent documentation

This commit is contained in:
Harvey Zack committed 2025-08-01 09:57:50 +08:00
1 parent 5337f9b075
commit ea392e0d60
10 files changed
+83 -9

No files matched your search

+2
View File
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased]
## [5.2.4] - 2025-08-01
- 为所有包添加 `ESM` 版本如 `artplayer/dist/artplayer.esm.js`
- 识别 `globalThis.CUSTOM_USER_AGENT` 全局变量,用于自定义 `navigator.userAgent`
- 修复 `artplayer-plugin-danmuku` 初始化时 `mount` 参数缺失的错误
@@ -1,6 +1,6 @@
/*!
* artplayer-plugin-danmuku.js v5.1.6
* artplayer-plugin-danmuku.js v5.1.7
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
+1 -1
View File
@@ -1,6 +1,6 @@
/*!
* artplayer-plugin-danmuku.js v5.1.6
* artplayer-plugin-danmuku.js v5.1.7
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
@@ -1,6 +1,6 @@
/*!
* artplayer-plugin-danmuku.js v5.1.6
* artplayer-plugin-danmuku.js v5.1.7
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
@@ -1,6 +1,6 @@
/*!
* artplayer-plugin-danmuku.js v5.1.6
* artplayer-plugin-danmuku.js v5.1.7
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
@@ -1,6 +1,6 @@
/*!
* artplayer-plugin-danmuku.js v5.1.6
* artplayer-plugin-danmuku.js v5.1.7
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
@@ -1,6 +1,6 @@
/*!
* artplayer-plugin-danmuku.js v5.1.6
* artplayer-plugin-danmuku.js v5.1.7
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
@@ -1,6 +1,6 @@
{
"license": "MIT",
"version": "5.1.6",
"version": "5.1.7",
"name": "artplayer-plugin-danmuku",
"description": "Danmuku plugin for ArtPlayer",
"main": "dist/artplayer-plugin-danmuku.js",
+37 -1
View File
@@ -404,4 +404,40 @@ Starting from `5.2.4`, `artplayer` and all plugins will also provide an `ESM` ve
</body>
</html>
```
```
## Custom userAgent
Currently, the determination of mobile devices is not accurate. Sometimes, you may want to adjust the player UI by changing the `userAgent`. Therefore, starting in version `5.2.4`, we added a new `globalThis.CUSTOM_USER_AGENT` global variable.
```html
<html>
<head>
<title>ArtPlayer Demo</title>
<meta charset="UTF-8" />
<style>
.artplayer-app {
width: 400px;
height: 300px;
}
</style>
</head>
<body>
<div class="artplayer-app"></div>
<script>globalThis.CUSTOM_USER_AGENT = 'iphone'</script>
<script src="path/to/artplayer.js"></script>
<script>
const art = new Artplayer({
container: '.artplayer-app',
url: 'path/to/video.mp4',
});
</script>
</body>
</html>
```
::: warning Warning
You need to modify it before import the `Artplayer` for it to take effect
:::
+37 -1
View File
@@ -409,4 +409,40 @@ https://unpkg.com/artplayer/dist/artplayer.legacy.js
</body>
</html>
```
```
## 自定义 userAgent
目前对于是否移动设备的判断并不准确,有时候希望通过改变 `userAgent` 来调整播放器的UI, 所以在 `5.2.4` 开始新增了一个 `globalThis.CUSTOM_USER_AGENT` 全局变量。
```html
<html>
<head>
<title>ArtPlayer Demo</title>
<meta charset="UTF-8" />
<style>
.artplayer-app {
width: 400px;
height: 300px;
}
</style>
</head>
<body>
<div class="artplayer-app"></div>
<script>globalThis.CUSTOM_USER_AGENT = 'iphone'</script>
<script src="path/to/artplayer.js"></script>
<script>
const art = new Artplayer({
container: '.artplayer-app',
url: 'path/to/video.mp4',
});
</script>
</body>
</html>
```
::: warning 提示
你需要在引入 `Artplayer` 依赖前来修改它才会生效
:::