@gcorevideo/player 2.8.1 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +169 -683
- package/lib/Player.js +1 -1
- package/lib/index.d.ts +1 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -5
- package/lib/plugins/dash-playback/DashPlayback.js +1 -1
- package/lib/plugins/hls-playback/HlsPlayback.js +1 -1
- package/package.json +2 -4
- package/rollup.config.js +0 -12
- package/src/Player.ts +1 -1
- package/src/index.ts +1 -5
- package/src/plugins/dash-playback/DashPlayback.ts +1 -1
- package/src/plugins/hls-playback/HlsPlayback.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/src/trace/LogTracer.ts +0 -23
- package/src/trace/SentryTracer.ts +0 -21
- package/src/trace/Tracer.ts +0 -27
- package/src/trace/index.ts +0 -32
- package/src/trace/types.ts +0 -7
- package/src/typings/@clappr/core/html5_video.d.ts +0 -28
- package/src/utils/Logger.ts +0 -107
package/src/utils/Logger.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
const APP_NAME = "gplayer";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @beta
|
|
5
|
-
*/
|
|
6
|
-
export type WriteFn = (...args: any[]) => void;
|
|
7
|
-
|
|
8
|
-
class DebuggerWrapper {
|
|
9
|
-
private currentWriter: WriteFn;
|
|
10
|
-
|
|
11
|
-
constructor(private writer: WriteFn, public readonly namespace: string, enabled = true) {
|
|
12
|
-
this.currentWriter = enabled ? writer : nullWriter;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
enable() {
|
|
16
|
-
this.currentWriter = this.writer;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
disable() {
|
|
20
|
-
this.currentWriter = nullWriter;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
write = (m: any, ...args: any[]) => {
|
|
24
|
-
const tokens = args.map((_) => "%s");
|
|
25
|
-
if (typeof m === "string" || args.length > 0) {
|
|
26
|
-
tokens.unshift("%s");
|
|
27
|
-
}
|
|
28
|
-
this.currentWriter(`${this.namespace}: ${tokens.join(' ')}`, m, ...args.map(a => JSON.stringify(a)));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
type Pattern = RegExp;
|
|
33
|
-
|
|
34
|
-
const currentPatterns: Pattern[] = [];
|
|
35
|
-
|
|
36
|
-
function parsePattern(pattern: string): Pattern {
|
|
37
|
-
if (pattern === "*") {
|
|
38
|
-
return /.?/;
|
|
39
|
-
}
|
|
40
|
-
return new RegExp("^" + pattern.replace(/\*/g, "[@\\w-]+"), "i");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function pass(namespace: string): boolean {
|
|
44
|
-
return currentPatterns.some((p) => p.test(namespace));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function nullWriter() {}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Logging utility with [debug](https://www.npmjs.com/package/debug)-like API
|
|
51
|
-
* @beta
|
|
52
|
-
*/
|
|
53
|
-
export class Logger {
|
|
54
|
-
public readonly info: WriteFn;
|
|
55
|
-
public readonly warn: WriteFn;
|
|
56
|
-
public readonly error: WriteFn;
|
|
57
|
-
public readonly debug: WriteFn;
|
|
58
|
-
|
|
59
|
-
private static items: DebuggerWrapper[] = [];
|
|
60
|
-
|
|
61
|
-
constructor(namespace: string, appName = APP_NAME) {
|
|
62
|
-
const ns = namespace ? `:${namespace}` : "";
|
|
63
|
-
|
|
64
|
-
const info = new DebuggerWrapper(console.info.bind(console), `${appName}:INFO${ns}`, pass(namespace));
|
|
65
|
-
this.info = info.write;
|
|
66
|
-
|
|
67
|
-
const warn = new DebuggerWrapper(console.warn.bind(console), `${appName}:WARN${ns}`, pass(namespace));
|
|
68
|
-
this.warn = warn.write;
|
|
69
|
-
|
|
70
|
-
const error = new DebuggerWrapper(console.error.bind(console), `${appName}:ERROR${ns}`, pass(namespace));
|
|
71
|
-
this.error = error.write;
|
|
72
|
-
|
|
73
|
-
const debug = new DebuggerWrapper(console.debug.bind(console), `${appName}:DEBUG${ns}`, pass(namespace));
|
|
74
|
-
this.debug = debug.write;
|
|
75
|
-
|
|
76
|
-
Logger.items.push(warn);
|
|
77
|
-
Logger.items.push(info);
|
|
78
|
-
Logger.items.push(error);
|
|
79
|
-
Logger.items.push(debug);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @param patterns - comma-separated list of patterns, can contain '*' as a wildcard
|
|
84
|
-
*/
|
|
85
|
-
static enable(patterns: string) {
|
|
86
|
-
currentPatterns.splice(
|
|
87
|
-
0,
|
|
88
|
-
currentPatterns.length,
|
|
89
|
-
...patterns.split(",").filter(Boolean).map(parsePattern),
|
|
90
|
-
);
|
|
91
|
-
Logger.toggleItems();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
static disable() {
|
|
95
|
-
currentPatterns.splice(0, currentPatterns.length);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private static toggleItems() {
|
|
99
|
-
for (const w of Logger.items) {
|
|
100
|
-
if (pass(w.namespace)) {
|
|
101
|
-
w.enable();
|
|
102
|
-
} else {
|
|
103
|
-
w.disable();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|