feat: Add support for video chapters in artplayer-plugin-chapter

This commit is contained in:
Harvey Zack committed 2024-06-02 13:07:26 +08:00
1 parent 502865ef65
commit eef1d675df
8 files changed
+98 -2

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
// npm i artplayer-plugin-chapter
// import artplayerPluginChapter from 'artplayer-plugin-chapter';
var art = new Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.mp4',
plugins: [
artplayerPluginChapter({
//
}),
],
});
+4
View File
@@ -65,6 +65,10 @@
<a
href="/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast">artplayer-plugin-vast</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-chapter/index.js&example=chapter">artplayer-plugin-chapter</a>
</li>
</ul>
<ul>
<li class="title">Library</li>
@@ -0,0 +1,11 @@
# artplayer-plugin-chapter
chapter plugin for ArtPlayer
## Demo
[https://artplayer.org](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chapter/index.js&example=chapter)
## License
MIT © Harvey Zack
@@ -0,0 +1,24 @@
{
"license": "MIT",
"version": "1.0.0",
"name": "artplayer-plugin-chapter",
"types": "types/artplayer-plugin-chapter.d.ts",
"description": "chapter plugin for ArtPlayer",
"main": "dist/artplayer-plugin-chapter.js",
"legacy": "dist/artplayer-plugin-chapter.legacy.js",
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
"browserslist": "last 1 Chrome version",
"homepage": "https://artplayer.org",
"repository": {
"type": "git",
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
},
"bugs": {
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
},
"keywords": [
"html5",
"video",
"player"
]
}
@@ -0,0 +1,26 @@
import style from 'bundle-text:./style.less';
export default function artplayerPluginChapter(option) {
return (art) => {
return {
name: 'artplayerPluginChapter',
};
};
}
if (typeof document !== 'undefined') {
const id = 'artplayer-plugin-chapter';
const $style = document.getElementById(id);
if ($style) {
$style.textContent = style;
} else {
const $style = document.createElement('style');
$style.id = id;
$style.textContent = style;
document.head.appendChild($style);
}
}
if (typeof window !== 'undefined') {
window['artplayerPluginChapter'] = artplayerPluginChapter;
}
@@ -0,0 +1,3 @@
.artplayer-plugin-chapter {
//
}
@@ -0,0 +1,14 @@
import type Artplayer from 'artplayer';
export = artplayerPluginChapter;
export as namespace artplayerPluginChapter;
type Option = {
//
};
type Result = {
name: 'artplayerPluginChapter';
};
declare const artplayerPluginChapter: (option: Option) => (art: Artplayer) => Result;
@@ -74,7 +74,8 @@ const config = {
{ text: '多重字幕', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles'},
{ text: 'Ass 字幕', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-libass/index.js&example=libass'},
{ text: 'Chromecast', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chromecast/index.js&example=chromecast'},
{ text: 'Vast', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast'},
{ text: 'Vast 广告', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast'},
{ text: '视频章节', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chapter/index.js&example=chapter'},
]
},
{
@@ -133,7 +134,8 @@ const config = {
{ text: 'Multiple Subtitles', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles'},
{ text: 'Ass Subtitle', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-libass/index.js&example=libass'},
{ text: 'Chromecast', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chromecast/index.js&example=chromecast'},
{ text: 'Vast', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast'},
{ text: 'Vast', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast'},
{ text: 'Video Chapters', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chapter/index.js&example=chapter'},
]
},
{