pr-player 0.2.6 → 0.2.8
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/README.md +3 -3
- package/dist/PrPlayer.d.ts +2 -1
- package/dist/decoder/Decoder.d.ts +11 -16
- package/dist/decoder/DecoderWorker.d.ts +4 -13
- package/dist/decoder/type.d.ts +4 -2
- package/dist/index.js +265 -259
- package/dist/index.umd.cjs +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,9 +33,6 @@ const player = new PrPlayer({ debug: true })
|
|
|
33
33
|
player.on.demuxer.chunk = (chunk) => {
|
|
34
34
|
console.log('\x1b[38;2;0;151;255m%c%s\x1b[0m', 'color:#0097ff;', `------->Breathe: chunk`, chunk)
|
|
35
35
|
}
|
|
36
|
-
player.on.demuxer.sei = (sei) => {
|
|
37
|
-
console.log('\x1b[38;2;0;151;255m%c%s\x1b[0m', 'color:#0097ff;', `------->Breathe: sei`, sei)
|
|
38
|
-
}
|
|
39
36
|
}
|
|
40
37
|
|
|
41
38
|
// 如果你只需要解码器相关的能力 可以拿到解码后的所有回调
|
|
@@ -46,6 +43,9 @@ const player = new PrPlayer({ debug: true })
|
|
|
46
43
|
player.on.decoder.video = (video) => {
|
|
47
44
|
console.log('\x1b[38;2;0;151;255m%c%s\x1b[0m', 'color:#0097ff;', `------->Breathe: video`, video)
|
|
48
45
|
}
|
|
46
|
+
player.on.decoder.sei = (sei) => {
|
|
47
|
+
console.log('\x1b[38;2;0;151;255m%c%s\x1b[0m', 'color:#0097ff;', `------->Breathe: sei`, sei)
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
await player.start('https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-720p.flv')
|
package/dist/PrPlayer.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ interface On {
|
|
|
4
4
|
info?: (_info: any) => void;
|
|
5
5
|
config?: (_config: any) => void;
|
|
6
6
|
chunk?: (_chunk: any) => void;
|
|
7
|
-
sei?: (_payload: Uint8Array) => void;
|
|
8
7
|
};
|
|
9
8
|
decoder: {
|
|
10
9
|
audio?: (_audio: {
|
|
@@ -15,7 +14,9 @@ interface On {
|
|
|
15
14
|
timestamp: number;
|
|
16
15
|
bitmap: ImageBitmap;
|
|
17
16
|
}) => void;
|
|
17
|
+
sei?: (_payload: Uint8Array) => void;
|
|
18
18
|
};
|
|
19
|
+
debug?: (_e: any) => void;
|
|
19
20
|
error?: (_e: any) => void;
|
|
20
21
|
}
|
|
21
22
|
interface PrPlayerOption {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pattern } from '../type';
|
|
2
|
-
import { On } from './type';
|
|
2
|
+
import { On, PendingChunk } from './type';
|
|
3
3
|
export declare class Decoder {
|
|
4
4
|
private pattern;
|
|
5
5
|
private audioDecoderConfig?;
|
|
@@ -9,38 +9,33 @@ export declare class Decoder {
|
|
|
9
9
|
private hasKeyFrame;
|
|
10
10
|
private baseTime;
|
|
11
11
|
private pendingChunks;
|
|
12
|
+
private currentChunk?;
|
|
12
13
|
private isProcessing;
|
|
13
14
|
private decodeTimer;
|
|
14
15
|
private frameTrack;
|
|
15
16
|
private isFrameTrack;
|
|
16
17
|
private fameTrackOption;
|
|
18
|
+
private decodingSpeedRatio;
|
|
19
|
+
private maxDecodingSpeedRatio;
|
|
17
20
|
private decodingSpeed;
|
|
18
21
|
private fps;
|
|
19
22
|
private firstVideoChunkTimestamp?;
|
|
20
23
|
private secondVideoChunkTimestamp?;
|
|
21
|
-
private
|
|
22
|
-
private maxDecodingSpeedRatio;
|
|
24
|
+
private frameStartTime?;
|
|
23
25
|
private lastRenderTime?;
|
|
24
26
|
private nextRenderTime?;
|
|
25
27
|
on: On;
|
|
26
28
|
constructor();
|
|
27
29
|
init: (pattern: Pattern) => void;
|
|
30
|
+
initAudio: (config: AudioDecoderConfig) => void;
|
|
31
|
+
initVideo: (config: VideoDecoderConfig) => void;
|
|
28
32
|
setFrameTrack: (frameTrack: boolean) => void;
|
|
33
|
+
push: (chunk: PendingChunk) => void;
|
|
34
|
+
destroy: () => void;
|
|
29
35
|
private initDecodeInterval;
|
|
30
36
|
private decode;
|
|
31
37
|
private decodeAudio;
|
|
32
38
|
private decodeVideo;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
init: (config: AudioDecoderConfig) => void;
|
|
36
|
-
push: (init: EncodedAudioChunkInit) => void;
|
|
37
|
-
flush: () => void;
|
|
38
|
-
destroy: () => void;
|
|
39
|
-
};
|
|
40
|
-
video: {
|
|
41
|
-
init: (config: VideoDecoderConfig) => void;
|
|
42
|
-
push: (init: EncodedVideoChunkInit) => void;
|
|
43
|
-
flush: () => void;
|
|
44
|
-
destroy: () => void;
|
|
45
|
-
};
|
|
39
|
+
private audio;
|
|
40
|
+
private video;
|
|
46
41
|
}
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { Pattern } from '../type';
|
|
2
|
-
import { On } from './type';
|
|
2
|
+
import { On, PendingChunk } from './type';
|
|
3
3
|
export declare class DecoderWorker {
|
|
4
4
|
worker: Worker;
|
|
5
5
|
on: On;
|
|
6
6
|
constructor();
|
|
7
7
|
init: (pattern: Pattern) => void;
|
|
8
|
+
initAudio: (config: AudioDecoderConfig) => void;
|
|
9
|
+
initVideo: (config: VideoDecoderConfig) => void;
|
|
10
|
+
push: (chunk: PendingChunk) => void;
|
|
8
11
|
setFrameTrack: (frameTrack: boolean) => void;
|
|
9
|
-
audio: {
|
|
10
|
-
init: (config: AudioDecoderConfig) => void;
|
|
11
|
-
push: (init: EncodedAudioChunkInit) => void;
|
|
12
|
-
flush: () => void;
|
|
13
|
-
destroy: () => void;
|
|
14
|
-
};
|
|
15
|
-
video: {
|
|
16
|
-
init: (config: VideoDecoderConfig) => void;
|
|
17
|
-
push: (init: EncodedVideoChunkInit) => void;
|
|
18
|
-
flush: () => void;
|
|
19
|
-
destroy: () => void;
|
|
20
|
-
};
|
|
21
12
|
destroy: () => void;
|
|
22
13
|
}
|
package/dist/decoder/type.d.ts
CHANGED
|
@@ -13,15 +13,17 @@ export interface On {
|
|
|
13
13
|
}) => void;
|
|
14
14
|
error?: (_e: DOMException) => void;
|
|
15
15
|
};
|
|
16
|
+
nalus?: (nalus: Uint8Array<ArrayBufferLike>[]) => void;
|
|
16
17
|
debug?: (_e: any) => void;
|
|
17
18
|
}
|
|
18
19
|
interface PendingAudioChunk {
|
|
19
|
-
|
|
20
|
+
kind: 'audio';
|
|
20
21
|
init: EncodedAudioChunkInit;
|
|
21
22
|
}
|
|
22
23
|
interface PendingVideoChunk {
|
|
23
|
-
|
|
24
|
+
kind: 'video';
|
|
24
25
|
init: EncodedAudioChunkInit;
|
|
26
|
+
nalus?: Uint8Array<ArrayBufferLike>[];
|
|
25
27
|
}
|
|
26
28
|
export type PendingChunk = PendingAudioChunk | PendingVideoChunk;
|
|
27
29
|
export {};
|