agora-electron-sdk 4.2.2-dev.4 → 4.2.2-dev.7
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/CHANGELOG.md +22 -0
- package/js/Private/AgoraBase.js +139 -53
- package/js/Private/AgoraMediaBase.js +13 -7
- package/js/Private/IAgoraRtcEngine.js +11 -11
- package/js/Private/IAgoraRtcEngineEx.js +1 -1
- package/js/Private/IAgoraSpatialAudio.js +2 -2
- package/js/Private/impl/IAgoraMediaEngineImpl.js +12 -6
- package/js/Private/impl/IAgoraRtcEngineImpl.js +7 -7
- package/js/Private/internal/IrisApiEngine.js +13 -0
- package/js/Private/internal/MusicContentCenterInternal.js +3 -0
- package/js/Private/internal/RtcEngineExInternal.js +24 -7
- package/js/Private/ti/IAgoraRtcEngine-ti.js +2 -2
- package/js/Renderer/WebGLRenderer/index.js +19 -19
- package/js/Renderer/YUVCanvasRenderer/index.js +1 -1
- package/package.json +3 -3
- package/scripts/zipBuild.js +3 -1
- package/ts/Private/AgoraBase.ts +296 -133
- package/ts/Private/AgoraMediaBase.ts +68 -34
- package/ts/Private/AgoraMediaPlayerTypes.ts +8 -5
- package/ts/Private/IAgoraLog.ts +7 -3
- package/ts/Private/IAgoraMediaEngine.ts +76 -35
- package/ts/Private/IAgoraMediaPlayer.ts +126 -64
- package/ts/Private/IAgoraMediaPlayerSource.ts +3 -1
- package/ts/Private/IAgoraRtcEngine.ts +1325 -530
- package/ts/Private/IAgoraRtcEngineEx.ts +227 -94
- package/ts/Private/IAgoraSpatialAudio.ts +71 -36
- package/ts/Private/IAudioDeviceManager.ts +61 -31
- package/ts/Private/impl/IAgoraMediaEngineImpl.ts +12 -6
- package/ts/Private/impl/IAgoraRtcEngineImpl.ts +9 -11
- package/ts/Private/internal/IrisApiEngine.ts +14 -0
- package/ts/Private/internal/MusicContentCenterInternal.ts +4 -0
- package/ts/Private/internal/RtcEngineExInternal.ts +36 -14
- package/ts/Private/ti/IAgoraRtcEngine-ti.ts +2 -2
- package/ts/Renderer/WebGLRenderer/index.ts +26 -21
- package/ts/Renderer/YUVCanvasRenderer/index.ts +1 -1
- package/types/Private/AgoraBase.d.ts +298 -135
- package/types/Private/AgoraBase.d.ts.map +1 -1
- package/types/Private/AgoraMediaBase.d.ts +69 -35
- package/types/Private/AgoraMediaBase.d.ts.map +1 -1
- package/types/Private/AgoraMediaPlayerTypes.d.ts +8 -5
- package/types/Private/AgoraMediaPlayerTypes.d.ts.map +1 -1
- package/types/Private/IAgoraLog.d.ts +7 -3
- package/types/Private/IAgoraLog.d.ts.map +1 -1
- package/types/Private/IAgoraMediaEngine.d.ts +76 -35
- package/types/Private/IAgoraMediaEngine.d.ts.map +1 -1
- package/types/Private/IAgoraMediaPlayer.d.ts +126 -64
- package/types/Private/IAgoraMediaPlayer.d.ts.map +1 -1
- package/types/Private/IAgoraMediaPlayerSource.d.ts +3 -1
- package/types/Private/IAgoraMediaPlayerSource.d.ts.map +1 -1
- package/types/Private/IAgoraRtcEngine.d.ts +1326 -530
- package/types/Private/IAgoraRtcEngine.d.ts.map +1 -1
- package/types/Private/IAgoraRtcEngineEx.d.ts +227 -94
- package/types/Private/IAgoraRtcEngineEx.d.ts.map +1 -1
- package/types/Private/IAgoraSpatialAudio.d.ts +71 -36
- package/types/Private/IAgoraSpatialAudio.d.ts.map +1 -1
- package/types/Private/IAudioDeviceManager.d.ts +61 -31
- package/types/Private/IAudioDeviceManager.d.ts.map +1 -1
- package/types/Private/impl/IAgoraMediaEngineImpl.d.ts +2 -2
- package/types/Private/impl/IAgoraMediaEngineImpl.d.ts.map +1 -1
- package/types/Private/impl/IAgoraRtcEngineImpl.d.ts +5 -5
- package/types/Private/impl/IAgoraRtcEngineImpl.d.ts.map +1 -1
- package/types/Private/internal/IrisApiEngine.d.ts.map +1 -1
- package/types/Private/internal/MusicContentCenterInternal.d.ts +1 -0
- package/types/Private/internal/MusicContentCenterInternal.d.ts.map +1 -1
- package/types/Private/internal/RtcEngineExInternal.d.ts.map +1 -1
- package/types/Renderer/WebGLRenderer/index.d.ts +1 -1
- package/types/Renderer/WebGLRenderer/index.d.ts.map +1 -1
|
@@ -337,6 +337,15 @@ export const EVENT_PROCESSORS: EventProcessors = {
|
|
|
337
337
|
},
|
|
338
338
|
};
|
|
339
339
|
|
|
340
|
+
// some events are not needed, so ignore them
|
|
341
|
+
function isIgnoredEvent(event: string, data: any) {
|
|
342
|
+
if (event === 'onLocalVideoStats' && 'connection' in data) {
|
|
343
|
+
return true;
|
|
344
|
+
} else {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
340
349
|
function handleEvent(...[event, data, buffers]: any) {
|
|
341
350
|
if (isDebuggable()) {
|
|
342
351
|
console.info('onEvent', event, data, buffers);
|
|
@@ -370,6 +379,9 @@ function handleEvent(...[event, data, buffers]: any) {
|
|
|
370
379
|
_event = _event.replace(/Ex$/g, '');
|
|
371
380
|
}
|
|
372
381
|
|
|
382
|
+
if (isIgnoredEvent(_event, _data)) {
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
373
385
|
const _buffers: Uint8Array[] = buffers;
|
|
374
386
|
if (processor.preprocess) {
|
|
375
387
|
processor.preprocess(_event, _data, _buffers);
|
|
@@ -386,6 +398,8 @@ function handleEvent(...[event, data, buffers]: any) {
|
|
|
386
398
|
}
|
|
387
399
|
|
|
388
400
|
emitEvent(_event, processor, _data);
|
|
401
|
+
|
|
402
|
+
return true;
|
|
389
403
|
}
|
|
390
404
|
|
|
391
405
|
/**
|
|
@@ -104,6 +104,10 @@ export class MusicContentCenterInternal extends IMusicContentCenterImpl {
|
|
|
104
104
|
const mediaPlayerId = super.createMusicPlayer() as number;
|
|
105
105
|
return new MusicPlayerInternal(mediaPlayerId);
|
|
106
106
|
}
|
|
107
|
+
|
|
108
|
+
protected getApiTypeFromPreload(songCode: number): string {
|
|
109
|
+
return 'MusicContentCenter_preload2';
|
|
110
|
+
}
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
class _MusicPlayerInternal extends IMusicPlayerImpl {
|
|
@@ -458,7 +458,7 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
|
|
|
458
458
|
channelId: string,
|
|
459
459
|
userAccount: string
|
|
460
460
|
): string {
|
|
461
|
-
return '
|
|
461
|
+
return 'RtcEngine_preloadChannel2';
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
override getAudioDeviceManager(): IAudioDeviceManager {
|
|
@@ -533,27 +533,49 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
|
|
|
533
533
|
iconSize: Size,
|
|
534
534
|
includeScreen: boolean
|
|
535
535
|
): ScreenCaptureSourceInfo[] {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
536
|
+
const apiType = this.getApiTypeFromGetScreenCaptureSources(
|
|
537
|
+
thumbSize,
|
|
538
|
+
iconSize,
|
|
539
|
+
includeScreen
|
|
540
|
+
);
|
|
541
|
+
const jsonParams = {
|
|
542
|
+
thumbSize: thumbSize,
|
|
543
|
+
iconSize: iconSize,
|
|
544
|
+
includeScreen: includeScreen,
|
|
545
|
+
toJSON: () => {
|
|
546
|
+
return {
|
|
547
|
+
thumbSize: thumbSize,
|
|
548
|
+
iconSize: iconSize,
|
|
549
|
+
includeScreen: includeScreen,
|
|
550
|
+
};
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
const { result, sources } = callIrisApi.call(this, apiType, jsonParams);
|
|
554
|
+
const screenCaptureSources = result.map(
|
|
555
|
+
(value: ScreenCaptureSourceInfo) => {
|
|
556
|
+
if (!value.thumbImage?.buffer || !value.thumbImage?.length) {
|
|
557
|
+
value.thumbImage!.buffer = undefined;
|
|
541
558
|
} else {
|
|
542
|
-
value.thumbImage
|
|
543
|
-
value.thumbImage
|
|
544
|
-
value.thumbImage
|
|
559
|
+
value.thumbImage!.buffer = AgoraEnv.AgoraElectronBridge.GetBuffer(
|
|
560
|
+
value.thumbImage!.buffer as unknown as number,
|
|
561
|
+
value.thumbImage.length!
|
|
545
562
|
);
|
|
546
563
|
}
|
|
547
|
-
if (value.iconImage
|
|
548
|
-
value.iconImage
|
|
564
|
+
if (!value.iconImage?.buffer || !value.iconImage?.length) {
|
|
565
|
+
value.iconImage!.buffer = undefined;
|
|
549
566
|
} else {
|
|
550
567
|
value.iconImage.buffer = AgoraEnv.AgoraElectronBridge.GetBuffer(
|
|
551
|
-
value.iconImage
|
|
552
|
-
value.iconImage.length
|
|
568
|
+
value.iconImage!.buffer as unknown as number,
|
|
569
|
+
value.iconImage.length!
|
|
553
570
|
);
|
|
554
571
|
}
|
|
555
572
|
return value;
|
|
556
|
-
}
|
|
573
|
+
}
|
|
574
|
+
);
|
|
575
|
+
callIrisApi.call(this, 'RtcEngine_releaseScreenCaptureSources', {
|
|
576
|
+
sources,
|
|
577
|
+
});
|
|
578
|
+
return screenCaptureSources;
|
|
557
579
|
}
|
|
558
580
|
|
|
559
581
|
override setupLocalVideo(canvas: VideoCanvas): number {
|
|
@@ -25,7 +25,7 @@ export const IRtcEngineEventHandler = t.iface([], {
|
|
|
25
25
|
"onDownlinkNetworkInfoUpdated": t.opt(t.func("void", t.param("info", "DownlinkNetworkInfo"))),
|
|
26
26
|
"onLastmileQuality": t.opt(t.func("void", t.param("quality", "QualityType"))),
|
|
27
27
|
"onFirstLocalVideoFrame": t.opt(t.func("void", t.param("source", "VideoSourceType"), t.param("width", "number"), t.param("height", "number"), t.param("elapsed", "number"))),
|
|
28
|
-
"onFirstLocalVideoFramePublished": t.opt(t.func("void", t.param("
|
|
28
|
+
"onFirstLocalVideoFramePublished": t.opt(t.func("void", t.param("source", "VideoSourceType"), t.param("elapsed", "number"))),
|
|
29
29
|
"onFirstRemoteVideoDecoded": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("remoteUid", "number"), t.param("width", "number"), t.param("height", "number"), t.param("elapsed", "number"))),
|
|
30
30
|
"onVideoSizeChanged": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("sourceType", "VideoSourceType"), t.param("uid", "number"), t.param("width", "number"), t.param("height", "number"), t.param("rotation", "number"))),
|
|
31
31
|
"onLocalVideoStateChanged": t.opt(t.func("void", t.param("source", "VideoSourceType"), t.param("state", "LocalVideoStreamState"), t.param("error", "LocalVideoStreamError"))),
|
|
@@ -40,7 +40,7 @@ export const IRtcEngineEventHandler = t.iface([], {
|
|
|
40
40
|
"onUserEnableLocalVideo": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("remoteUid", "number"), t.param("enabled", "boolean"))),
|
|
41
41
|
"onLocalAudioStats": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("stats", "LocalAudioStats"))),
|
|
42
42
|
"onRemoteAudioStats": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("stats", "RemoteAudioStats"))),
|
|
43
|
-
"onLocalVideoStats": t.opt(t.func("void", t.param("
|
|
43
|
+
"onLocalVideoStats": t.opt(t.func("void", t.param("source", "VideoSourceType"), t.param("stats", "LocalVideoStats"))),
|
|
44
44
|
"onRemoteVideoStats": t.opt(t.func("void", t.param("connection", "RtcConnection"), t.param("stats", "RemoteVideoStats"))),
|
|
45
45
|
"onCameraReady": t.opt(t.func("void")),
|
|
46
46
|
"onCameraFocusAreaChanged": t.opt(t.func("void", t.param("x", "number"), t.param("y", "number"), t.param("width", "number"), t.param("height", "number"))),
|
|
@@ -46,7 +46,6 @@ const yuvShaderSource =
|
|
|
46
46
|
|
|
47
47
|
export class GlRenderer extends IRenderer {
|
|
48
48
|
gl: WebGL2RenderingContext | undefined | null;
|
|
49
|
-
handleContextLost: any;
|
|
50
49
|
program: any;
|
|
51
50
|
positionLocation: any;
|
|
52
51
|
texCoordLocation: any;
|
|
@@ -127,6 +126,12 @@ export class GlRenderer extends IRenderer {
|
|
|
127
126
|
logWarn('webgl renderer unbind happen some error', e);
|
|
128
127
|
}
|
|
129
128
|
|
|
129
|
+
this.canvas &&
|
|
130
|
+
this.canvas.removeEventListener(
|
|
131
|
+
'webglcontextlost',
|
|
132
|
+
this.handleContextLost,
|
|
133
|
+
false
|
|
134
|
+
);
|
|
130
135
|
this.canvas = undefined;
|
|
131
136
|
this.container = undefined;
|
|
132
137
|
this.parentElement = undefined;
|
|
@@ -448,6 +453,25 @@ export class GlRenderer extends IRenderer {
|
|
|
448
453
|
}
|
|
449
454
|
}
|
|
450
455
|
|
|
456
|
+
private handleContextLost = () => {
|
|
457
|
+
try {
|
|
458
|
+
this.canvas &&
|
|
459
|
+
this.canvas.removeEventListener(
|
|
460
|
+
'webglcontextlost',
|
|
461
|
+
this.handleContextLost,
|
|
462
|
+
false
|
|
463
|
+
);
|
|
464
|
+
} catch (error) {
|
|
465
|
+
logWarn('webglcontextlost error', error);
|
|
466
|
+
} finally {
|
|
467
|
+
this.gl = undefined;
|
|
468
|
+
this.failInitRenderCB &&
|
|
469
|
+
this.failInitRenderCB({
|
|
470
|
+
error: 'Browser not support! No WebGL detected.',
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
|
|
451
475
|
private initCanvas(
|
|
452
476
|
view: HTMLElement,
|
|
453
477
|
width: number,
|
|
@@ -487,28 +511,9 @@ export class GlRenderer extends IRenderer {
|
|
|
487
511
|
preserveDrawingBuffer: true,
|
|
488
512
|
});
|
|
489
513
|
// context list after toggle resolution on electron 12.0.6
|
|
490
|
-
let handleContextLost = () => {
|
|
491
|
-
try {
|
|
492
|
-
this.gl = null;
|
|
493
|
-
this.canvas &&
|
|
494
|
-
this.canvas.removeEventListener(
|
|
495
|
-
'webglcontextlost',
|
|
496
|
-
handleContextLost,
|
|
497
|
-
false
|
|
498
|
-
);
|
|
499
|
-
} catch (error) {
|
|
500
|
-
logWarn('webglcontextlost error', error);
|
|
501
|
-
} finally {
|
|
502
|
-
this.gl = undefined;
|
|
503
|
-
this.failInitRenderCB &&
|
|
504
|
-
this.failInitRenderCB({
|
|
505
|
-
error: 'Browser not support! No WebGL detected.',
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
514
|
this.canvas.addEventListener(
|
|
510
515
|
'webglcontextlost',
|
|
511
|
-
handleContextLost,
|
|
516
|
+
this.handleContextLost,
|
|
512
517
|
false
|
|
513
518
|
);
|
|
514
519
|
} catch (e) {
|
|
@@ -153,7 +153,7 @@ export class YUVCanvasRenderer extends IRenderer {
|
|
|
153
153
|
this.canvas.style.transform = `scale(${scale.toString()})`;
|
|
154
154
|
|
|
155
155
|
if (transformItems.length > 0) {
|
|
156
|
-
this.canvas.style.transform
|
|
156
|
+
this.canvas.style.transform += ` ${transformItems.join(' ')}`;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
}
|