mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
flv demo
This commit is contained in:
1 parent
9f90774b4f
commit
3f451aa047
12 files changed
+191
-147
No files matched your search
@@ -9,7 +9,6 @@ import Whitelist from './whitelist';
|
||||
import Template from './template';
|
||||
import I18n from './i18n';
|
||||
import Player from './player';
|
||||
import Mse from './mse';
|
||||
import Controls from './controls';
|
||||
import Contextmenu from './contextmenu';
|
||||
import Info from './info';
|
||||
@@ -116,7 +115,6 @@ class Artplayer extends Emitter {
|
||||
this.notice = new Notice(this);
|
||||
this.events = new Events(this);
|
||||
this.player = new Player(this);
|
||||
this.mse = new Mse(this);
|
||||
this.layers = new Layers(this);
|
||||
this.controls = new Controls(this);
|
||||
this.contextmenu = new Contextmenu(this);
|
||||
|
||||
@@ -6,37 +6,31 @@ export default function attachUrlMix(art, player) {
|
||||
template: { $video },
|
||||
} = art;
|
||||
|
||||
Object.defineProperty(player, 'returnUrl', {
|
||||
writable: true,
|
||||
value: url => url,
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'attachUrl', {
|
||||
value: url => {
|
||||
value: url => sleep().then(() => {
|
||||
function attachUrl(videoUrl) {
|
||||
const typeName = type || getExt(videoUrl);
|
||||
const typeCallback = customType[typeName];
|
||||
return sleep().then(() => {
|
||||
if (typeName && typeCallback) {
|
||||
art.emit('beforeCustomType', typeName);
|
||||
typeCallback($video, player.returnUrl(videoUrl), art);
|
||||
art.emit('afterCustomType', typeName);
|
||||
} else {
|
||||
art.emit('beforeAttachUrl', videoUrl);
|
||||
$video.src = player.returnUrl(videoUrl);
|
||||
art.emit('afterAttachUrl', $video.src);
|
||||
}
|
||||
});
|
||||
if (typeName && typeCallback) {
|
||||
art.emit('beforeCustomType', typeName);
|
||||
typeCallback.call(art, $video, videoUrl, art);
|
||||
art.emit('afterCustomType', typeName);
|
||||
} else {
|
||||
art.emit('beforeAttachUrl', videoUrl);
|
||||
$video.src = videoUrl;
|
||||
art.emit('afterAttachUrl', videoUrl);
|
||||
}
|
||||
return Promise.resolve(videoUrl);
|
||||
}
|
||||
|
||||
if (typeof url === 'function') {
|
||||
return url().then(videoUrl => {
|
||||
return url.call(art).then(videoUrl => {
|
||||
art.loading.show();
|
||||
return attachUrl(videoUrl);
|
||||
});
|
||||
}
|
||||
|
||||
return attachUrl(url);
|
||||
},
|
||||
}),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user