add artplayer-plugin-ass

This commit is contained in:
Harvey committed 2020-11-24 15:48:49 +08:00
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;
}