@nativescript/canvas-media 2.0.11 → 2.0.14
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/VideoFrame/common.d.ts +122 -0
- package/VideoFrame/common.js +173 -0
- package/VideoFrame/common.js.map +1 -0
- package/VideoFrame/index.android.d.ts +12 -0
- package/VideoFrame/index.android.js +113 -0
- package/VideoFrame/index.android.js.map +1 -0
- package/VideoFrame/index.ios.d.ts +12 -0
- package/VideoFrame/index.ios.js +122 -0
- package/VideoFrame/index.ios.js.map +1 -0
- package/audio/common.d.ts +29 -3
- package/audio/common.js +90 -0
- package/audio/common.js.map +1 -1
- package/audio/index.android.d.ts +32 -1
- package/audio/index.android.js +219 -1
- package/audio/index.android.js.map +1 -1
- package/audio/index.ios.d.ts +27 -4
- package/audio/index.ios.js +183 -142
- package/audio/index.ios.js.map +1 -1
- package/common.d.ts +1 -0
- package/common.js +3 -0
- package/common.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas_media.aar +0 -0
- package/platforms/android/java/org/nativescript/canvas/media/AudioHelper.java +338 -0
- package/platforms/android/java/org/nativescript/canvas/media/AudioView.java +125 -0
- package/platforms/android/java/org/nativescript/canvas/media/SimpleCacheProvider.java +27 -0
- package/platforms/android/java/org/nativescript/canvas/media/VideoHelper.java +204 -5
- package/platforms/ios/src/NSCAudioHelper.h +47 -0
- package/platforms/ios/src/NSCAudioHelper.m +713 -0
- package/platforms/ios/src/NSCAudioView.h +20 -0
- package/platforms/ios/src/NSCAudioView.m +270 -0
- package/platforms/ios/src/NSCCanvasMediaUmbrella.h +3 -1
- package/platforms/ios/src/NSCVideoHelper.h +6 -0
- package/platforms/ios/src/NSCVideoHelper.m +111 -4
- package/video/common.d.ts +4 -0
- package/video/common.js +3 -0
- package/video/common.js.map +1 -1
- package/video/index.android.d.ts +3 -1
- package/video/index.android.js +44 -8
- package/video/index.android.js.map +1 -1
- package/video/index.ios.d.ts +2 -0
- package/video/index.ios.js +28 -0
- package/video/index.ios.js.map +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export type VideoPixelFormat = 'I420' | 'I420A' | 'I422' | 'I444' | 'NV12' | 'RGBA' | 'RGBX' | 'BGRA' | 'BGRX';
|
|
2
|
+
export type VideoColorPrimaries = 'bt709' | 'bt470bg' | 'smpte170m' | 'bt2020' | 'smpte432';
|
|
3
|
+
export type VideoTransferCharacteristics = 'bt709' | 'smpte170m' | 'iec61966-2-1' | 'linear' | 'pq' | 'hlg';
|
|
4
|
+
export type VideoMatrixCoefficients = 'rgb' | 'bt709' | 'bt470bg' | 'smpte170m' | 'bt2020-ncl';
|
|
5
|
+
export interface VideoColorSpaceInit {
|
|
6
|
+
primaries?: VideoColorPrimaries | null;
|
|
7
|
+
transfer?: VideoTransferCharacteristics | null;
|
|
8
|
+
matrix?: VideoMatrixCoefficients | null;
|
|
9
|
+
fullRange?: boolean | null;
|
|
10
|
+
}
|
|
11
|
+
export declare class VideoColorSpace {
|
|
12
|
+
readonly primaries: VideoColorPrimaries | null;
|
|
13
|
+
readonly transfer: VideoTransferCharacteristics | null;
|
|
14
|
+
readonly matrix: VideoMatrixCoefficients | null;
|
|
15
|
+
readonly fullRange: boolean | null;
|
|
16
|
+
constructor(init?: VideoColorSpaceInit);
|
|
17
|
+
toJSON(): VideoColorSpaceInit;
|
|
18
|
+
}
|
|
19
|
+
export declare class DOMRectReadOnly {
|
|
20
|
+
readonly x: number;
|
|
21
|
+
readonly y: number;
|
|
22
|
+
readonly width: number;
|
|
23
|
+
readonly height: number;
|
|
24
|
+
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
25
|
+
get top(): number;
|
|
26
|
+
get right(): number;
|
|
27
|
+
get bottom(): number;
|
|
28
|
+
get left(): number;
|
|
29
|
+
toJSON(): {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
top: number;
|
|
35
|
+
right: number;
|
|
36
|
+
bottom: number;
|
|
37
|
+
left: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export declare class DOMException extends Error {
|
|
41
|
+
constructor(message?: string, name?: string);
|
|
42
|
+
}
|
|
43
|
+
export interface VideoFrameInit {
|
|
44
|
+
duration?: number | null;
|
|
45
|
+
timestamp?: number;
|
|
46
|
+
alpha?: 'keep' | 'discard';
|
|
47
|
+
visibleRect?: RectInit;
|
|
48
|
+
displayWidth?: number;
|
|
49
|
+
displayHeight?: number;
|
|
50
|
+
colorSpace?: VideoColorSpaceInit;
|
|
51
|
+
}
|
|
52
|
+
export interface VideoFrameBufferInit {
|
|
53
|
+
format: VideoPixelFormat;
|
|
54
|
+
codedWidth: number;
|
|
55
|
+
codedHeight: number;
|
|
56
|
+
timestamp: number;
|
|
57
|
+
duration?: number;
|
|
58
|
+
layout?: PlaneLayout[];
|
|
59
|
+
visibleRect?: RectInit;
|
|
60
|
+
displayWidth?: number;
|
|
61
|
+
displayHeight?: number;
|
|
62
|
+
colorSpace?: VideoColorSpaceInit;
|
|
63
|
+
}
|
|
64
|
+
export interface VideoFrameCopyToOptions {
|
|
65
|
+
rect?: RectInit;
|
|
66
|
+
layout?: PlaneLayout[];
|
|
67
|
+
}
|
|
68
|
+
export interface PlaneLayout {
|
|
69
|
+
offset: number;
|
|
70
|
+
stride: number;
|
|
71
|
+
}
|
|
72
|
+
export interface RectInit {
|
|
73
|
+
x?: number;
|
|
74
|
+
y?: number;
|
|
75
|
+
width?: number;
|
|
76
|
+
height?: number;
|
|
77
|
+
}
|
|
78
|
+
export interface _VideoFrameData {
|
|
79
|
+
pixelData: Uint8Array | null;
|
|
80
|
+
codedWidth: number;
|
|
81
|
+
codedHeight: number;
|
|
82
|
+
displayWidth: number;
|
|
83
|
+
displayHeight: number;
|
|
84
|
+
timestamp: number;
|
|
85
|
+
duration?: number | null;
|
|
86
|
+
format: VideoPixelFormat;
|
|
87
|
+
colorSpace?: VideoColorSpaceInit;
|
|
88
|
+
}
|
|
89
|
+
export declare const _INTERNAL: unique symbol;
|
|
90
|
+
export declare abstract class VideoFrameBase {
|
|
91
|
+
protected _closed: boolean;
|
|
92
|
+
protected _pixelData: Uint8Array | null;
|
|
93
|
+
readonly format: VideoPixelFormat | null;
|
|
94
|
+
readonly codedWidth: number;
|
|
95
|
+
readonly codedHeight: number;
|
|
96
|
+
readonly codedRect: DOMRectReadOnly;
|
|
97
|
+
readonly visibleRect: DOMRectReadOnly;
|
|
98
|
+
readonly displayWidth: number;
|
|
99
|
+
readonly displayHeight: number;
|
|
100
|
+
readonly duration?: number | null;
|
|
101
|
+
readonly timestamp: number;
|
|
102
|
+
readonly colorSpace: VideoColorSpace;
|
|
103
|
+
protected constructor(data: _VideoFrameData);
|
|
104
|
+
protected abstract _doClone(): VideoFrameBase;
|
|
105
|
+
/**
|
|
106
|
+
* Direct read-only access to the underlying RGBA pixel buffer.
|
|
107
|
+
*
|
|
108
|
+
* This is a non-standard extension for performance-critical consumers such as
|
|
109
|
+
* WebGL uploaders that can pass the Uint8Array straight to `texImage2D` without
|
|
110
|
+
* the extra copy that `copyTo()` would incur. The returned array is a live view
|
|
111
|
+
* of the frame's backing store — do not mutate it, and do not hold a reference
|
|
112
|
+
* after calling `close()`.
|
|
113
|
+
*/
|
|
114
|
+
get pixelData(): Uint8Array | null;
|
|
115
|
+
allocationSize(options?: VideoFrameCopyToOptions): number;
|
|
116
|
+
copyTo(destination: ArrayBuffer | ArrayBufferView, options?: VideoFrameCopyToOptions): Promise<PlaneLayout[]>;
|
|
117
|
+
clone(): this;
|
|
118
|
+
close(): void;
|
|
119
|
+
protected _assertOpen(): void;
|
|
120
|
+
private _resolveRect;
|
|
121
|
+
}
|
|
122
|
+
export declare function bgraToRgba(src: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export class VideoColorSpace {
|
|
2
|
+
constructor(init = {}) {
|
|
3
|
+
this.primaries = init.primaries ?? null;
|
|
4
|
+
this.transfer = init.transfer ?? null;
|
|
5
|
+
this.matrix = init.matrix ?? null;
|
|
6
|
+
this.fullRange = init.fullRange ?? null;
|
|
7
|
+
}
|
|
8
|
+
toJSON() {
|
|
9
|
+
return {
|
|
10
|
+
primaries: this.primaries,
|
|
11
|
+
transfer: this.transfer,
|
|
12
|
+
matrix: this.matrix,
|
|
13
|
+
fullRange: this.fullRange,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class DOMRectReadOnly {
|
|
18
|
+
constructor(x = 0, y = 0, width = 0, height = 0) {
|
|
19
|
+
this.x = x;
|
|
20
|
+
this.y = y;
|
|
21
|
+
this.width = width;
|
|
22
|
+
this.height = height;
|
|
23
|
+
}
|
|
24
|
+
get top() {
|
|
25
|
+
return this.y;
|
|
26
|
+
}
|
|
27
|
+
get right() {
|
|
28
|
+
return this.x + this.width;
|
|
29
|
+
}
|
|
30
|
+
get bottom() {
|
|
31
|
+
return this.y + this.height;
|
|
32
|
+
}
|
|
33
|
+
get left() {
|
|
34
|
+
return this.x;
|
|
35
|
+
}
|
|
36
|
+
toJSON() {
|
|
37
|
+
return {
|
|
38
|
+
x: this.x,
|
|
39
|
+
y: this.y,
|
|
40
|
+
width: this.width,
|
|
41
|
+
height: this.height,
|
|
42
|
+
top: this.top,
|
|
43
|
+
right: this.right,
|
|
44
|
+
bottom: this.bottom,
|
|
45
|
+
left: this.left,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export class DOMException extends Error {
|
|
50
|
+
constructor(message = '', name = 'Error') {
|
|
51
|
+
super(message);
|
|
52
|
+
this.name = name;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export const _INTERNAL = Symbol('VideoFrame.internal');
|
|
56
|
+
const SRGB_COLOR_SPACE = {
|
|
57
|
+
primaries: 'bt709',
|
|
58
|
+
transfer: 'iec61966-2-1',
|
|
59
|
+
matrix: 'rgb',
|
|
60
|
+
fullRange: true,
|
|
61
|
+
};
|
|
62
|
+
export class VideoFrameBase {
|
|
63
|
+
constructor(data) {
|
|
64
|
+
this._closed = false;
|
|
65
|
+
this.format = data.format;
|
|
66
|
+
this.codedWidth = data.codedWidth;
|
|
67
|
+
this.codedHeight = data.codedHeight;
|
|
68
|
+
this.codedRect = new DOMRectReadOnly(0, 0, data.codedWidth, data.codedHeight);
|
|
69
|
+
this.visibleRect = new DOMRectReadOnly(0, 0, data.codedWidth, data.codedHeight);
|
|
70
|
+
this.displayWidth = data.displayWidth;
|
|
71
|
+
this.displayHeight = data.displayHeight;
|
|
72
|
+
this.duration = data.duration;
|
|
73
|
+
this.timestamp = data.timestamp;
|
|
74
|
+
this.colorSpace = new VideoColorSpace(data.colorSpace ?? SRGB_COLOR_SPACE);
|
|
75
|
+
this._pixelData = data.pixelData;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Direct read-only access to the underlying RGBA pixel buffer.
|
|
79
|
+
*
|
|
80
|
+
* This is a non-standard extension for performance-critical consumers such as
|
|
81
|
+
* WebGL uploaders that can pass the Uint8Array straight to `texImage2D` without
|
|
82
|
+
* the extra copy that `copyTo()` would incur. The returned array is a live view
|
|
83
|
+
* of the frame's backing store — do not mutate it, and do not hold a reference
|
|
84
|
+
* after calling `close()`.
|
|
85
|
+
*/
|
|
86
|
+
get pixelData() {
|
|
87
|
+
this._assertOpen();
|
|
88
|
+
return this._pixelData;
|
|
89
|
+
}
|
|
90
|
+
allocationSize(options) {
|
|
91
|
+
this._assertOpen();
|
|
92
|
+
const rect = this._resolveRect(options?.rect);
|
|
93
|
+
return rect.width * rect.height * 4; // RGBA = 4 bytes/pixel
|
|
94
|
+
}
|
|
95
|
+
copyTo(destination, options) {
|
|
96
|
+
try {
|
|
97
|
+
this._assertOpen();
|
|
98
|
+
if (!this._pixelData) {
|
|
99
|
+
return Promise.reject(new DOMException('No pixel data available — frame may not have been captured yet', 'InvalidStateError'));
|
|
100
|
+
}
|
|
101
|
+
const rect = this._resolveRect(options?.rect);
|
|
102
|
+
const stride = rect.width * 4;
|
|
103
|
+
const needed = stride * rect.height;
|
|
104
|
+
let dest;
|
|
105
|
+
if (destination instanceof ArrayBuffer) {
|
|
106
|
+
if (destination.byteLength < needed) {
|
|
107
|
+
return Promise.reject(new RangeError(`Destination buffer too small: need ${needed} bytes, have ${destination.byteLength}`));
|
|
108
|
+
}
|
|
109
|
+
dest = new Uint8Array(destination);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
const view = destination;
|
|
113
|
+
if (view.byteLength < needed) {
|
|
114
|
+
return Promise.reject(new RangeError(`Destination buffer too small: need ${needed} bytes, have ${view.byteLength}`));
|
|
115
|
+
}
|
|
116
|
+
dest = new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
117
|
+
}
|
|
118
|
+
const srcStride = this.codedWidth * 4;
|
|
119
|
+
const isFullFrame = rect.x === 0 && rect.y === 0 && rect.width === this.codedWidth && rect.height === this.codedHeight;
|
|
120
|
+
if (isFullFrame) {
|
|
121
|
+
dest.set(this._pixelData.subarray(0, needed));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
for (let row = 0; row < rect.height; row++) {
|
|
125
|
+
const srcOff = (rect.y + row) * srcStride + rect.x * 4;
|
|
126
|
+
const dstOff = row * stride;
|
|
127
|
+
dest.set(this._pixelData.subarray(srcOff, srcOff + stride), dstOff);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return Promise.resolve([{ offset: 0, stride }]);
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
return Promise.reject(err);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
clone() {
|
|
137
|
+
this._assertOpen();
|
|
138
|
+
return this._doClone();
|
|
139
|
+
}
|
|
140
|
+
close() {
|
|
141
|
+
if (this._closed)
|
|
142
|
+
return;
|
|
143
|
+
this._closed = true;
|
|
144
|
+
this._pixelData = null;
|
|
145
|
+
}
|
|
146
|
+
_assertOpen() {
|
|
147
|
+
if (this._closed) {
|
|
148
|
+
throw new DOMException('VideoFrame is closed', 'InvalidStateError');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
_resolveRect(rect) {
|
|
152
|
+
if (!rect) {
|
|
153
|
+
return { x: 0, y: 0, width: this.codedWidth, height: this.codedHeight };
|
|
154
|
+
}
|
|
155
|
+
const x = Math.max(0, Math.floor(rect.x ?? 0));
|
|
156
|
+
const y = Math.max(0, Math.floor(rect.y ?? 0));
|
|
157
|
+
const width = Math.min(this.codedWidth - x, Math.max(0, Math.floor(rect.width ?? this.codedWidth)));
|
|
158
|
+
const height = Math.min(this.codedHeight - y, Math.max(0, Math.floor(rect.height ?? this.codedHeight)));
|
|
159
|
+
return { x, y, width, height };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
export function bgraToRgba(src) {
|
|
163
|
+
const dst = new Uint8Array(src.length);
|
|
164
|
+
const len = src.length;
|
|
165
|
+
for (let i = 0; i < len; i += 4) {
|
|
166
|
+
dst[i] = src[i + 2]; // R ← B
|
|
167
|
+
dst[i + 1] = src[i + 1]; // G
|
|
168
|
+
dst[i + 2] = src[i]; // B ← R
|
|
169
|
+
dst[i + 3] = src[i + 3]; // A
|
|
170
|
+
}
|
|
171
|
+
return dst;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../packages/canvas-media/VideoFrame/common.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,eAAe;IAM3B,YAAY,OAA4B,EAAE;QACzC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAA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AG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACxG,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChC,CAAC;CACD;AAED,MAAM,UAAU,UAAU,CAAC,GAAe;IACzC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACjC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ;QAC7B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;QAC7B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;QAC7B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;IAC9B,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VideoFrameBase, VideoColorSpace, DOMRectReadOnly, VideoFrameInit, VideoFrameBufferInit, VideoFrameCopyToOptions, PlaneLayout, RectInit, VideoPixelFormat, VideoColorSpaceInit, _INTERNAL } from './common';
|
|
2
|
+
export { VideoColorSpace, DOMRectReadOnly, _INTERNAL };
|
|
3
|
+
export type { VideoPixelFormat, VideoFrameInit, VideoFrameBufferInit, VideoFrameCopyToOptions, PlaneLayout, RectInit, VideoColorSpaceInit };
|
|
4
|
+
export declare class VideoFrame extends VideoFrameBase {
|
|
5
|
+
constructor(source: ArrayBuffer | ArrayBufferView, init: VideoFrameBufferInit);
|
|
6
|
+
constructor(source: object, init?: VideoFrameInit);
|
|
7
|
+
static fromVideo(source: any, init?: VideoFrameInit): VideoFrame | null;
|
|
8
|
+
private static _dataFromBuffer;
|
|
9
|
+
private static _dataFromVideoSource;
|
|
10
|
+
private static _assertBufferInit;
|
|
11
|
+
protected _doClone(): VideoFrame;
|
|
12
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { VideoFrameBase, VideoColorSpace, DOMRectReadOnly, _INTERNAL, bgraToRgba } from './common';
|
|
2
|
+
export { VideoColorSpace, DOMRectReadOnly, _INTERNAL };
|
|
3
|
+
export class VideoFrame extends VideoFrameBase {
|
|
4
|
+
constructor(source, init) {
|
|
5
|
+
if (source === _INTERNAL) {
|
|
6
|
+
super(init);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (source instanceof ArrayBuffer || ArrayBuffer.isView(source)) {
|
|
10
|
+
super(VideoFrame._dataFromBuffer(source, init));
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
super(VideoFrame._dataFromVideoSource(source, init));
|
|
14
|
+
}
|
|
15
|
+
static fromVideo(source, init) {
|
|
16
|
+
try {
|
|
17
|
+
const data = VideoFrame._dataFromVideoSource(source, init);
|
|
18
|
+
// Return null when no pixel data is available yet (e.g. video not loaded,
|
|
19
|
+
// setupBitmapSurface hasn't fired, or no frame has been decoded).
|
|
20
|
+
// Callers can treat null as "not ready" and fall back to drawImage.
|
|
21
|
+
if (!data.pixelData)
|
|
22
|
+
return null;
|
|
23
|
+
return new VideoFrame(_INTERNAL, data);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
if (__ANDROID__) {
|
|
27
|
+
console.error('[VideoFrame] fromVideo:', err?.message ?? err);
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
static _dataFromBuffer(source, init) {
|
|
33
|
+
VideoFrame._assertBufferInit(init);
|
|
34
|
+
const buf = ArrayBuffer.isView(source) ? new Uint8Array(source.buffer, source.byteOffset, source.byteLength) : new Uint8Array(source);
|
|
35
|
+
const pixelData = init.format === 'BGRA' || init.format === 'BGRX' ? bgraToRgba(buf) : new Uint8Array(buf);
|
|
36
|
+
return {
|
|
37
|
+
pixelData,
|
|
38
|
+
codedWidth: init.codedWidth,
|
|
39
|
+
codedHeight: init.codedHeight,
|
|
40
|
+
displayWidth: init.displayWidth ?? init.codedWidth,
|
|
41
|
+
displayHeight: init.displayHeight ?? init.codedHeight,
|
|
42
|
+
timestamp: init.timestamp,
|
|
43
|
+
duration: init.duration ?? null,
|
|
44
|
+
format: 'RGBA',
|
|
45
|
+
colorSpace: init.colorSpace,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
static _dataFromVideoSource(source, init) {
|
|
49
|
+
const video = source?._video ?? source;
|
|
50
|
+
const instance = video?._instance;
|
|
51
|
+
if (!instance) {
|
|
52
|
+
throw new TypeError('[VideoFrame] Source must be an HTMLVideoElement or a canvas-media Video instance');
|
|
53
|
+
}
|
|
54
|
+
const currentTimeSec = instance.getCurrentTime();
|
|
55
|
+
const timestampUs = typeof init?.timestamp === 'number' ? init.timestamp : Math.round(currentTimeSec * 1000000);
|
|
56
|
+
const rgbaBuffer = instance.getRgbaBuffer();
|
|
57
|
+
let pixelData = null;
|
|
58
|
+
let codedWidth = 0;
|
|
59
|
+
let codedHeight = 0;
|
|
60
|
+
if (rgbaBuffer) {
|
|
61
|
+
codedWidth = instance.getLastRgbaWidth();
|
|
62
|
+
codedHeight = instance.getLastRgbaHeight();
|
|
63
|
+
if (codedWidth > 0 && codedHeight > 0) {
|
|
64
|
+
pixelData = new Uint8Array(ArrayBuffer.from(rgbaBuffer));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (codedWidth === 0 || codedHeight === 0) {
|
|
68
|
+
codedWidth = video._videoWidth ?? 0;
|
|
69
|
+
codedHeight = video._videoHeight ?? 0;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
pixelData,
|
|
73
|
+
codedWidth,
|
|
74
|
+
codedHeight,
|
|
75
|
+
displayWidth: init?.displayWidth ?? codedWidth,
|
|
76
|
+
displayHeight: init?.displayHeight ?? codedHeight,
|
|
77
|
+
timestamp: timestampUs,
|
|
78
|
+
duration: init?.duration ?? null,
|
|
79
|
+
format: 'RGBA',
|
|
80
|
+
colorSpace: init?.colorSpace,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
static _assertBufferInit(init) {
|
|
84
|
+
if (!init?.format) {
|
|
85
|
+
throw new TypeError('VideoFrame: init.format is required for the buffer constructor');
|
|
86
|
+
}
|
|
87
|
+
if (!init?.codedWidth || init.codedWidth <= 0) {
|
|
88
|
+
throw new TypeError('VideoFrame: init.codedWidth must be a positive integer');
|
|
89
|
+
}
|
|
90
|
+
if (!init?.codedHeight || init.codedHeight <= 0) {
|
|
91
|
+
throw new TypeError('VideoFrame: init.codedHeight must be a positive integer');
|
|
92
|
+
}
|
|
93
|
+
if (typeof init?.timestamp !== 'number' || !isFinite(init.timestamp)) {
|
|
94
|
+
throw new TypeError('VideoFrame: init.timestamp must be a finite number (microseconds)');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
_doClone() {
|
|
98
|
+
const pixelCopy = this._pixelData ? new Uint8Array(this._pixelData) : null;
|
|
99
|
+
const data = {
|
|
100
|
+
pixelData: pixelCopy,
|
|
101
|
+
codedWidth: this.codedWidth,
|
|
102
|
+
codedHeight: this.codedHeight,
|
|
103
|
+
displayWidth: this.displayWidth,
|
|
104
|
+
displayHeight: this.displayHeight,
|
|
105
|
+
timestamp: this.timestamp,
|
|
106
|
+
duration: this.duration,
|
|
107
|
+
format: this.format,
|
|
108
|
+
colorSpace: this.colorSpace.toJSON(),
|
|
109
|
+
};
|
|
110
|
+
return new VideoFrame(_INTERNAL, data);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=index.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../../../packages/canvas-media/VideoFrame/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAgJ,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEjP,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AAGvD,MAAM,OAAO,UAAW,SAAQ,cAAc;IAG7C,YAAY,MAAW,EAAE,IAAU;QAClC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAuB,CAAC,CAAC;YAC/B,OAAO;QACR,CAAC;QAED,IAAI,MAAM,YAAY,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACjE,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,IAA4B,CAAC,CAAC,CAAC;YACxE,OAAO;QACR,CAAC;QACD,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,MAAM,EAAE,IAAsB,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,MAAW,EAAE,IAAqB;QAClD,IAAI,CAAC;YACJ,MAAM,IAAI,GAAG,UAAU,CAAC,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC3D,0EAA0E;YAC1E,kEAAkE;YAClE,oEAAoE;YACpE,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAC;YACjC,OAAO,IAAI,UAAU,CAAC,SAAgB,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,GAAQ,EAAE,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,IAAI,UAAU,CAAC,SAAgB,EAAE,IAAW,CAAC,CAAC;IACtD,CAAC;CACD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VideoFrameBase, VideoColorSpace, DOMRectReadOnly, VideoFrameInit, VideoFrameBufferInit, VideoFrameCopyToOptions, PlaneLayout, RectInit, VideoPixelFormat, VideoColorSpaceInit, _INTERNAL } from './common';
|
|
2
|
+
export { VideoColorSpace, DOMRectReadOnly, _INTERNAL };
|
|
3
|
+
export type { VideoPixelFormat, VideoFrameInit, VideoFrameBufferInit, VideoFrameCopyToOptions, PlaneLayout, RectInit, VideoColorSpaceInit };
|
|
4
|
+
export declare class VideoFrame extends VideoFrameBase {
|
|
5
|
+
constructor(source: ArrayBuffer | ArrayBufferView, init: VideoFrameBufferInit);
|
|
6
|
+
constructor(source: object, init?: VideoFrameInit);
|
|
7
|
+
static fromVideo(source: any, init?: VideoFrameInit): VideoFrame | null;
|
|
8
|
+
private static _dataFromBuffer;
|
|
9
|
+
private static _dataFromVideoSource;
|
|
10
|
+
private static _assertBufferInit;
|
|
11
|
+
protected _doClone(): VideoFrame;
|
|
12
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { VideoFrameBase, VideoColorSpace, DOMRectReadOnly, _INTERNAL, bgraToRgba } from './common';
|
|
2
|
+
export { VideoColorSpace, DOMRectReadOnly, _INTERNAL };
|
|
3
|
+
export class VideoFrame extends VideoFrameBase {
|
|
4
|
+
constructor(source, init) {
|
|
5
|
+
if (source === _INTERNAL) {
|
|
6
|
+
super(init);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (source instanceof ArrayBuffer || ArrayBuffer.isView(source)) {
|
|
10
|
+
super(VideoFrame._dataFromBuffer(source, init));
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
super(VideoFrame._dataFromVideoSource(source, init));
|
|
14
|
+
}
|
|
15
|
+
static fromVideo(source, init) {
|
|
16
|
+
try {
|
|
17
|
+
const data = VideoFrame._dataFromVideoSource(source, init);
|
|
18
|
+
// Return null when no pixel data is available yet (e.g. video not loaded,
|
|
19
|
+
// AVPlayerItemVideoOutput has no pixel buffer at the current time).
|
|
20
|
+
// Callers can treat null as "not ready" and fall back to drawImage.
|
|
21
|
+
if (!data.pixelData)
|
|
22
|
+
return null;
|
|
23
|
+
return new VideoFrame(_INTERNAL, data);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
if (__IOS__) {
|
|
27
|
+
console.error('[VideoFrame] fromVideo:', err?.message ?? err);
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
static _dataFromBuffer(source, init) {
|
|
33
|
+
VideoFrame._assertBufferInit(init);
|
|
34
|
+
const buf = ArrayBuffer.isView(source) ? new Uint8Array(source.buffer, source.byteOffset, source.byteLength) : new Uint8Array(source);
|
|
35
|
+
const pixelData = init.format === 'BGRA' || init.format === 'BGRX' ? bgraToRgba(buf) : new Uint8Array(buf);
|
|
36
|
+
return {
|
|
37
|
+
pixelData,
|
|
38
|
+
codedWidth: init.codedWidth,
|
|
39
|
+
codedHeight: init.codedHeight,
|
|
40
|
+
displayWidth: init.displayWidth ?? init.codedWidth,
|
|
41
|
+
displayHeight: init.displayHeight ?? init.codedHeight,
|
|
42
|
+
timestamp: init.timestamp,
|
|
43
|
+
duration: init.duration ?? null,
|
|
44
|
+
format: 'RGBA',
|
|
45
|
+
colorSpace: init.colorSpace,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
static _dataFromVideoSource(source, init) {
|
|
49
|
+
const video = source?._video ?? source;
|
|
50
|
+
const helper = video?.helper;
|
|
51
|
+
if (!helper) {
|
|
52
|
+
throw new TypeError('[VideoFrame] Source must be an HTMLVideoElement or a canvas-media Video instance');
|
|
53
|
+
}
|
|
54
|
+
if (!helper.isInForeground) {
|
|
55
|
+
throw new DOMException('[VideoFrame] Cannot capture a frame while the video is in the background', 'InvalidStateError');
|
|
56
|
+
}
|
|
57
|
+
if (!helper.player || !helper.assetOutput) {
|
|
58
|
+
throw new DOMException('[VideoFrame] Video is not ready — wait for the loadeddata event before capturing frames', 'InvalidStateError');
|
|
59
|
+
}
|
|
60
|
+
const timestampUs = typeof init?.timestamp === 'number' ? init.timestamp : Math.round(helper.currentTime * 1000000);
|
|
61
|
+
const frameDict = NSCRender.getVideoFrameData(helper.player, helper.assetOutput, helper.videoSize);
|
|
62
|
+
let pixelData = null;
|
|
63
|
+
let codedWidth = 0;
|
|
64
|
+
let codedHeight = 0;
|
|
65
|
+
if (frameDict) {
|
|
66
|
+
const nsData = frameDict.objectForKey('data');
|
|
67
|
+
const wNum = frameDict.objectForKey('width');
|
|
68
|
+
const hNum = frameDict.objectForKey('height');
|
|
69
|
+
codedWidth = typeof wNum === 'number' ? wNum : (wNum?.intValue ?? 0);
|
|
70
|
+
codedHeight = typeof hNum === 'number' ? hNum : (hNum?.intValue ?? 0);
|
|
71
|
+
if (nsData && codedWidth > 0 && codedHeight > 0) {
|
|
72
|
+
pixelData = new Uint8Array(interop.bufferFromData(nsData));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (codedWidth === 0 || codedHeight === 0) {
|
|
76
|
+
const size = helper.videoSize;
|
|
77
|
+
codedWidth = size ? size.width | 0 : 0;
|
|
78
|
+
codedHeight = size ? size.height | 0 : 0;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
pixelData,
|
|
82
|
+
codedWidth,
|
|
83
|
+
codedHeight,
|
|
84
|
+
displayWidth: init?.displayWidth ?? codedWidth,
|
|
85
|
+
displayHeight: init?.displayHeight ?? codedHeight,
|
|
86
|
+
timestamp: timestampUs,
|
|
87
|
+
duration: init?.duration ?? null,
|
|
88
|
+
format: 'RGBA',
|
|
89
|
+
colorSpace: init?.colorSpace,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
static _assertBufferInit(init) {
|
|
93
|
+
if (!init?.format) {
|
|
94
|
+
throw new TypeError('VideoFrame: init.format is required for the buffer constructor');
|
|
95
|
+
}
|
|
96
|
+
if (!init?.codedWidth || init.codedWidth <= 0) {
|
|
97
|
+
throw new TypeError('VideoFrame: init.codedWidth must be a positive integer');
|
|
98
|
+
}
|
|
99
|
+
if (!init?.codedHeight || init.codedHeight <= 0) {
|
|
100
|
+
throw new TypeError('VideoFrame: init.codedHeight must be a positive integer');
|
|
101
|
+
}
|
|
102
|
+
if (typeof init?.timestamp !== 'number' || !isFinite(init.timestamp)) {
|
|
103
|
+
throw new TypeError('VideoFrame: init.timestamp must be a finite number (microseconds)');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
_doClone() {
|
|
107
|
+
const pixelCopy = this._pixelData ? new Uint8Array(this._pixelData) : null;
|
|
108
|
+
const data = {
|
|
109
|
+
pixelData: pixelCopy,
|
|
110
|
+
codedWidth: this.codedWidth,
|
|
111
|
+
codedHeight: this.codedHeight,
|
|
112
|
+
displayWidth: this.displayWidth,
|
|
113
|
+
displayHeight: this.displayHeight,
|
|
114
|
+
timestamp: this.timestamp,
|
|
115
|
+
duration: this.duration,
|
|
116
|
+
format: this.format,
|
|
117
|
+
colorSpace: this.colorSpace.toJSON(),
|
|
118
|
+
};
|
|
119
|
+
return new VideoFrame(_INTERNAL, data);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=index.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../../packages/canvas-media/VideoFrame/index.ios.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAgJ,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEjP,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AAMvD,MAAM,OAAO,UAAW,SAAQ,cAAc;IAG7C,YAAY,MAAW,EAAE,IAAU;QAClC,IAAI,MAAM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EAAE,IAAI,CAAC,UAAU;YAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAA0B;YACvC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;SACpC,CAAC;QACF,OAAO,IAAI,UAAU,CAAC,SAAgB,EAAE,IAAW,CAAC,CAAC;IACtD,CAAC;CACD"}
|
package/audio/common.d.ts
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { MediaBase } from '../common';
|
|
2
2
|
export declare abstract class AudioBase extends MediaBase {
|
|
3
|
-
controls: boolean;
|
|
4
|
-
loop: boolean;
|
|
5
|
-
|
|
3
|
+
abstract controls: boolean;
|
|
4
|
+
abstract loop: boolean;
|
|
5
|
+
abstract autoplay: boolean;
|
|
6
|
+
static playingEvent: string;
|
|
7
|
+
static playEvent: string;
|
|
8
|
+
static pauseEvent: string;
|
|
9
|
+
static canplayEvent: string;
|
|
10
|
+
static canplaythroughEvent: string;
|
|
11
|
+
static timeupdateEvent: string;
|
|
12
|
+
static durationchangeEvent: string;
|
|
13
|
+
static loadedmetadataEvent: string;
|
|
14
|
+
static loadeddataEvent: string;
|
|
15
|
+
static endedEvent: string;
|
|
16
|
+
static errorEvent: string;
|
|
17
|
+
static readonly HAVE_NOTHING = 0;
|
|
18
|
+
static readonly HAVE_METADATA = 1;
|
|
19
|
+
static readonly HAVE_CURRENT_DATA = 2;
|
|
20
|
+
static readonly HAVE_FUTURE_DATA = 3;
|
|
21
|
+
static readonly HAVE_ENOUGH_DATA = 4;
|
|
22
|
+
abstract play(): Promise<void>;
|
|
23
|
+
abstract pause(): void;
|
|
24
|
+
abstract load(): void;
|
|
25
|
+
_capturedListeners: Record<string, Function[]>;
|
|
26
|
+
_listeners: Record<string, Function[]>;
|
|
27
|
+
addEventListener(type: string, listener: Function, useCapture?: boolean | any): void;
|
|
28
|
+
removeEventListener(type: string, listener: Function, useCapture?: boolean | any): void;
|
|
29
|
+
_notifyListener(type: string): void;
|
|
30
|
+
_removeListener(type: string, listener: Function, listenersObj: any): void;
|
|
31
|
+
_listenerExist(type: string, listener: Function, listenersObj: any): boolean;
|
|
6
32
|
}
|