优化检测支持函数

This commit is contained in:
Harvey Zack committed 2018-12-18 10:53:36 +08:00
1 parent b7e740ae61
commit f63ae33be7
5 files changed
+34 -41

No files matched your search

@@ -1,5 +1,5 @@
import Emitter from 'tiny-emitter';
import CheckSupport from './checkSupport';
import checkSupport from './checkSupport';
import EventProxy from './eventProxy';
import CreatMediaSource from './creatMediaSource';
import * as utils from './utils';
@@ -9,15 +9,10 @@ let id = 0;
class Flv extends Emitter {
constructor(mediaElement, url) {
super();
utils.errorHandle(mediaElement instanceof HTMLVideoElement, 'The first parameter is not a video tag element');
utils.errorHandle(typeof url === 'string', 'The second parameter is not a string type');
checkSupport(mediaElement, url);
this.mediaElement = mediaElement;
this.url = url;
this.support = new CheckSupport(this);
this.events = new EventProxy(this);
this.mediaSource = new CreatMediaSource(this);
id += 1;
this.id = id;
Flv.instances.push(this);
@@ -36,7 +31,9 @@ class Flv extends Emitter {
}
load() {
console.log(this.id);
this.events = new EventProxy(this);
this.mediaSource = new CreatMediaSource(this);
this.emit('load');
}
destroy() {