优化结构

This commit is contained in:
Harvey Zack committed 2018-12-14 17:03:41 +08:00
1 parent c6869686c3
commit f2658673dc
6 files changed
+369 -404

No files matched your search

+12 -9
View File
@@ -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);
},
};
}