mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-16 17:46:17 -08:00
update common code
This commit is contained in:
1 parent
495782f5c6
commit
11bc295663
14 files changed
+59
-44
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
export default class Contextmenu {
|
||||
constructor({ option }) {
|
||||
//
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
export default class Danmu {
|
||||
constructor({ option }) {
|
||||
//
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
export default class Events {
|
||||
constructor({ option }) {
|
||||
//
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
export default class Hotkey {
|
||||
constructor({ option }) {
|
||||
//
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import Info from './info';
|
||||
import Subtitle from './subtitle';
|
||||
import Events from './events';
|
||||
import Hotkey from './hotkey';
|
||||
import Layers from './layers';
|
||||
|
||||
let id = 0;
|
||||
export const instances = [];
|
||||
@@ -77,6 +78,7 @@ class Artplayer extends Emitter {
|
||||
this.info = new Info(this);
|
||||
this.events = new Events(this);
|
||||
this.hotkey = new Hotkey(this);
|
||||
this.layers = new Layers(this);
|
||||
|
||||
this.id = id++;
|
||||
instances.push(this);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
export default class Info {
|
||||
constructor({ option }) {
|
||||
//
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export default class Layers {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,6 @@ export default class Mse {
|
||||
|
||||
this.art.on('mediaSource:sourceopen', () => {
|
||||
this.sourceBuffer = this.mediaSource.addSourceBuffer(option.mimeCodec);
|
||||
|
||||
sourceBuffer.events.forEach(eventName => {
|
||||
this.sourceBuffer.addEventListener(eventName, this.sourceBufferEventFn);
|
||||
this.art.destroyEvents.push(() => {
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
export default class Captions {
|
||||
constructor({ option }) {
|
||||
//
|
||||
export default class Subtitle {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
export default class ArtPlayerError extends Error {
|
||||
constructor(message) {
|
||||
constructor(message, context) {
|
||||
super(message);
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
if (typeof Error.captureStackTrace === 'function') {
|
||||
Error.captureStackTrace(this, context || this.constructor);
|
||||
}
|
||||
this.name = 'ArtPlayerError';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user