mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
优化结构
This commit is contained in:
1 parent
c6869686c3
commit
f2658673dc
6 files changed
+369
-404
No files matched your search
@@ -1,16 +1,19 @@
|
||||
import Flv from './flv';
|
||||
|
||||
function artplayerPluginFlv(art) {
|
||||
const {
|
||||
template: { $video },
|
||||
} = art;
|
||||
const flv = new Flv($video);
|
||||
let flv = null;
|
||||
|
||||
art.on('destroy', () => {
|
||||
if (flv) {
|
||||
flv.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
load: url =>
|
||||
new Promise(resolve => {
|
||||
flv.loadUrl(url).start();
|
||||
return resolve(flv.mediaSource.url);
|
||||
}),
|
||||
flv,
|
||||
init: (mediaElement, url) => {
|
||||
flv = new Flv(mediaElement, url);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user