mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 12:41:20 -08:00
add artplayer-plugin-ass
This commit is contained in:
1 parent
f414b9d9a4
commit
d911e206f4
13 files changed
+2357
-4
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import ASS from 'assjs';
|
||||
import './style.scss';
|
||||
|
||||
function artplayerPluginAss(url) {
|
||||
return (art) => {
|
||||
let ass = null;
|
||||
fetch(url)
|
||||
.then((res) => res.text())
|
||||
.then((text) => {
|
||||
const { $video, $subtitle } = art.template;
|
||||
$subtitle.classList.add('artplayer-plugin-ass');
|
||||
|
||||
art.once('ready', () => {
|
||||
ass = new ASS(text, $video, {
|
||||
container: $subtitle,
|
||||
resampling: 'video_width',
|
||||
});
|
||||
|
||||
ass.resize();
|
||||
art.emit('artplayerPluginAss', ass);
|
||||
art.on('resize', () => ass.resize());
|
||||
art.on('destroy', () => ass.destroy());
|
||||
});
|
||||
});
|
||||
return {
|
||||
name: 'artplayerPluginAss',
|
||||
ass,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export default artplayerPluginAss;
|
||||
@@ -0,0 +1,3 @@
|
||||
.artplayer-plugin-ass {
|
||||
bottom: 0 !important;
|
||||
}
|
||||
Reference in new issue
Block a user