mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 21:31:20 -08:00
bugfix
This commit is contained in:
1 parent
151290d3ae
commit
bf740f6de9
4 files changed
+21
-1
No files matched your search
@@ -1,7 +1,13 @@
|
||||
import { errorHandle, getExt } from './utils';
|
||||
|
||||
export default class Subtitle {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
if (this.art.option.subtitle) {
|
||||
errorHandle(
|
||||
getExt(this.art.option.subtitle) === 'vtt',
|
||||
`'subtitle' option require 'vtt' format, but got '${getExt(this.art.option.subtitle)}'.`
|
||||
);
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
@@ -51,6 +57,10 @@ export default class Subtitle {
|
||||
}
|
||||
|
||||
change(url) {
|
||||
errorHandle(
|
||||
getExt(url) === 'vtt',
|
||||
`'url' option require 'vtt' format, but got '${getExt(url)}'.`
|
||||
);
|
||||
this.art.refs.$track.src = url;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,10 @@ export function request(url) {
|
||||
}
|
||||
|
||||
export function getExt(url) {
|
||||
if (url.includes('?')) {
|
||||
return getExt(url.split('?')[0]);
|
||||
}
|
||||
|
||||
return url
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
|
||||
Reference in new issue
Block a user