mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
refactor(hls): [PKG-HLS-04] migrate modules and compatible types
This commit is contained in:
1 parent
ba93b98be5
commit
2f9bee4ee0
34 files changed
+4860
-88
No files matched your search
@@ -129,6 +129,7 @@ function subscribeHls(hls, refresh, destroyed) {
|
||||
if (!events || typeof hls.on !== "function" || typeof hls.off !== "function")
|
||||
return () => {
|
||||
};
|
||||
const source = hls;
|
||||
const subscriptions = [];
|
||||
let active = true;
|
||||
function release() {
|
||||
@@ -136,7 +137,7 @@ function subscribeHls(hls, refresh, destroyed) {
|
||||
return;
|
||||
active = false;
|
||||
for (const [event, callback] of subscriptions)
|
||||
hls.off(event, callback);
|
||||
source.off(event, callback);
|
||||
subscriptions.length = 0;
|
||||
}
|
||||
try {
|
||||
@@ -153,7 +154,7 @@ function subscribeHls(hls, refresh, destroyed) {
|
||||
refresh();
|
||||
};
|
||||
subscriptions.push([event, callback]);
|
||||
hls.on(event, callback);
|
||||
source.on(event, callback);
|
||||
}
|
||||
} catch (error) {
|
||||
release();
|
||||
@@ -162,7 +163,8 @@ function subscribeHls(hls, refresh, destroyed) {
|
||||
return release;
|
||||
}
|
||||
function artplayerPluginHlsControl(option = {}) {
|
||||
return (art) => {
|
||||
return (player) => {
|
||||
const art = player;
|
||||
const { $video } = art.template;
|
||||
const { errorHandle } = art.constructor.utils;
|
||||
let closed = false;
|
||||
|
||||
Reference in new issue
Block a user