agora-electron-sdk 4.2.0-dev.4 → 4.2.0-dev.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.
Files changed (270) hide show
  1. package/js/AgoraSdk.js +4 -2
  2. package/js/Private/AgoraBase.js +1154 -6
  3. package/js/Private/AgoraMediaBase.js +308 -0
  4. package/js/Private/AgoraMediaPlayerTypes.js +112 -0
  5. package/js/Private/IAgoraLog.js +12 -0
  6. package/js/Private/IAgoraMediaStreamingSource.js +10 -0
  7. package/js/Private/IAgoraMusicContentCenter.js +104 -0
  8. package/js/Private/IAgoraRhythmPlayer.js +8 -0
  9. package/js/Private/IAgoraRtcEngine.js +843 -0
  10. package/js/Private/IAgoraRtcEngineEx.js +8 -0
  11. package/js/Private/IAgoraSpatialAudio.js +44 -0
  12. package/js/Private/impl/IAgoraMediaPlayerImpl.js +59 -59
  13. package/js/Private/impl/IAgoraRtcEngineImpl.js +55 -46
  14. package/js/Private/internal/IrisApiEngine.js +7 -12
  15. package/js/Private/internal/MediaEngineInternal.js +7 -11
  16. package/js/Private/internal/MediaPlayerInternal.js +22 -20
  17. package/js/Private/internal/MediaRecorderInternal.js +4 -4
  18. package/js/Private/internal/MusicContentCenterInternal.js +7 -9
  19. package/js/Private/internal/RtcEngineExInternal.js +52 -62
  20. package/js/Renderer/AgoraView.js +21 -24
  21. package/js/Renderer/IRenderer.js +6 -13
  22. package/js/Renderer/IRendererManager.js +9 -0
  23. package/js/Renderer/RendererManager.js +49 -33
  24. package/js/Renderer/{GlRenderer → WebGLRenderer}/index.js +39 -45
  25. package/js/Renderer/YUVCanvasRenderer/index.js +8 -7
  26. package/js/Renderer/index.js +18 -0
  27. package/js/Utils.js +6 -8
  28. package/package.json +5 -4
  29. package/scripts/buildJS.js +1 -2
  30. package/scripts/getConfig.js +0 -1
  31. package/ts/AgoraSdk.ts +5 -2
  32. package/ts/Private/IAgoraMediaPlayer.ts +45 -45
  33. package/ts/Private/IAgoraRtcEngine.ts +33 -25
  34. package/ts/Private/impl/IAgoraMediaPlayerImpl.ts +84 -84
  35. package/ts/Private/impl/IAgoraRtcEngineImpl.ts +75 -65
  36. package/ts/Private/internal/IrisApiEngine.ts +0 -2
  37. package/ts/Private/internal/RtcEngineExInternal.ts +23 -12
  38. package/ts/Renderer/AgoraView.ts +1 -0
  39. package/ts/Renderer/IRenderer.ts +8 -14
  40. package/ts/Renderer/IRendererManager.ts +35 -0
  41. package/ts/Renderer/RendererManager.ts +9 -9
  42. package/ts/Renderer/{GlRenderer → WebGLRenderer}/index.ts +26 -45
  43. package/ts/Renderer/YUVCanvasRenderer/index.ts +8 -10
  44. package/ts/Renderer/index.ts +2 -0
  45. package/ts/Types.ts +15 -9
  46. package/ts/Utils.ts +4 -6
  47. package/types/AgoraSdk.d.ts +4 -2
  48. package/types/AgoraSdk.d.ts.map +1 -0
  49. package/types/Private/AgoraBase.d.ts +1 -0
  50. package/types/Private/AgoraBase.d.ts.map +1 -0
  51. package/types/Private/AgoraMediaBase.d.ts +1 -0
  52. package/types/Private/AgoraMediaBase.d.ts.map +1 -0
  53. package/types/Private/AgoraMediaPlayerTypes.d.ts +1 -0
  54. package/types/Private/AgoraMediaPlayerTypes.d.ts.map +1 -0
  55. package/types/Private/IAgoraLog.d.ts +1 -0
  56. package/types/Private/IAgoraLog.d.ts.map +1 -0
  57. package/types/Private/IAgoraMediaEngine.d.ts +1 -0
  58. package/types/Private/IAgoraMediaEngine.d.ts.map +1 -0
  59. package/types/Private/IAgoraMediaPlayer.d.ts +35 -34
  60. package/types/Private/IAgoraMediaPlayer.d.ts.map +1 -0
  61. package/types/Private/IAgoraMediaPlayerSource.d.ts +1 -0
  62. package/types/Private/IAgoraMediaPlayerSource.d.ts.map +1 -0
  63. package/types/Private/IAgoraMediaRecorder.d.ts +1 -0
  64. package/types/Private/IAgoraMediaRecorder.d.ts.map +1 -0
  65. package/types/Private/IAgoraMediaStreamingSource.d.ts +1 -0
  66. package/types/Private/IAgoraMediaStreamingSource.d.ts.map +1 -0
  67. package/types/Private/IAgoraMusicContentCenter.d.ts +1 -0
  68. package/types/Private/IAgoraMusicContentCenter.d.ts.map +1 -0
  69. package/types/Private/IAgoraRhythmPlayer.d.ts +1 -0
  70. package/types/Private/IAgoraRhythmPlayer.d.ts.map +1 -0
  71. package/types/Private/IAgoraRtcEngine.d.ts +27 -19
  72. package/types/Private/IAgoraRtcEngine.d.ts.map +1 -0
  73. package/types/Private/IAgoraRtcEngineEx.d.ts +1 -0
  74. package/types/Private/IAgoraRtcEngineEx.d.ts.map +1 -0
  75. package/types/Private/IAgoraSpatialAudio.d.ts +1 -0
  76. package/types/Private/IAgoraSpatialAudio.d.ts.map +1 -0
  77. package/types/Private/IAudioDeviceManager.d.ts +1 -0
  78. package/types/Private/IAudioDeviceManager.d.ts.map +1 -0
  79. package/types/Private/extension/AgoraBaseExtension.d.ts +1 -0
  80. package/types/Private/extension/AgoraBaseExtension.d.ts.map +1 -0
  81. package/types/Private/extension/AgoraMediaBaseExtension.d.ts +1 -0
  82. package/types/Private/extension/AgoraMediaBaseExtension.d.ts.map +1 -0
  83. package/types/Private/extension/AgoraMediaPlayerTypesExtension.d.ts +1 -0
  84. package/types/Private/extension/AgoraMediaPlayerTypesExtension.d.ts.map +1 -0
  85. package/types/Private/extension/IAgoraLogExtension.d.ts +1 -0
  86. package/types/Private/extension/IAgoraLogExtension.d.ts.map +1 -0
  87. package/types/Private/extension/IAgoraMediaEngineExtension.d.ts +1 -0
  88. package/types/Private/extension/IAgoraMediaEngineExtension.d.ts.map +1 -0
  89. package/types/Private/extension/IAgoraMediaPlayerExtension.d.ts +1 -0
  90. package/types/Private/extension/IAgoraMediaPlayerExtension.d.ts.map +1 -0
  91. package/types/Private/extension/IAgoraMediaPlayerSourceExtension.d.ts +1 -0
  92. package/types/Private/extension/IAgoraMediaPlayerSourceExtension.d.ts.map +1 -0
  93. package/types/Private/extension/IAgoraMediaRecorderExtension.d.ts +1 -0
  94. package/types/Private/extension/IAgoraMediaRecorderExtension.d.ts.map +1 -0
  95. package/types/Private/extension/IAgoraMusicContentCenterExtension.d.ts +1 -0
  96. package/types/Private/extension/IAgoraMusicContentCenterExtension.d.ts.map +1 -0
  97. package/types/Private/extension/IAgoraRhythmPlayerExtension.d.ts +1 -0
  98. package/types/Private/extension/IAgoraRhythmPlayerExtension.d.ts.map +1 -0
  99. package/types/Private/extension/IAgoraRtcEngineExExtension.d.ts +1 -0
  100. package/types/Private/extension/IAgoraRtcEngineExExtension.d.ts.map +1 -0
  101. package/types/Private/extension/IAgoraRtcEngineExtension.d.ts +1 -0
  102. package/types/Private/extension/IAgoraRtcEngineExtension.d.ts.map +1 -0
  103. package/types/Private/extension/IAgoraSpatialAudioExtension.d.ts +1 -0
  104. package/types/Private/extension/IAgoraSpatialAudioExtension.d.ts.map +1 -0
  105. package/types/Private/extension/IAudioDeviceManagerExtension.d.ts +1 -0
  106. package/types/Private/extension/IAudioDeviceManagerExtension.d.ts.map +1 -0
  107. package/types/Private/impl/AgoraBaseImpl.d.ts +1 -0
  108. package/types/Private/impl/AgoraBaseImpl.d.ts.map +1 -0
  109. package/types/Private/impl/AgoraMediaBaseImpl.d.ts +1 -0
  110. package/types/Private/impl/AgoraMediaBaseImpl.d.ts.map +1 -0
  111. package/types/Private/impl/IAgoraMediaEngineImpl.d.ts +1 -0
  112. package/types/Private/impl/IAgoraMediaEngineImpl.d.ts.map +1 -0
  113. package/types/Private/impl/IAgoraMediaPlayerImpl.d.ts +9 -8
  114. package/types/Private/impl/IAgoraMediaPlayerImpl.d.ts.map +1 -0
  115. package/types/Private/impl/IAgoraMediaPlayerSourceImpl.d.ts +1 -0
  116. package/types/Private/impl/IAgoraMediaPlayerSourceImpl.d.ts.map +1 -0
  117. package/types/Private/impl/IAgoraMediaRecorderImpl.d.ts +1 -0
  118. package/types/Private/impl/IAgoraMediaRecorderImpl.d.ts.map +1 -0
  119. package/types/Private/impl/IAgoraMusicContentCenterImpl.d.ts +1 -0
  120. package/types/Private/impl/IAgoraMusicContentCenterImpl.d.ts.map +1 -0
  121. package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts +1 -0
  122. package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts.map +1 -0
  123. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts +13 -10
  124. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts.map +1 -0
  125. package/types/Private/impl/IAgoraSpatialAudioImpl.d.ts +1 -0
  126. package/types/Private/impl/IAgoraSpatialAudioImpl.d.ts.map +1 -0
  127. package/types/Private/impl/IAudioDeviceManagerImpl.d.ts +1 -0
  128. package/types/Private/impl/IAudioDeviceManagerImpl.d.ts.map +1 -0
  129. package/types/Private/internal/AudioDeviceManagerInternal.d.ts +1 -0
  130. package/types/Private/internal/AudioDeviceManagerInternal.d.ts.map +1 -0
  131. package/types/Private/internal/IrisApiEngine.d.ts +8 -7
  132. package/types/Private/internal/IrisApiEngine.d.ts.map +1 -0
  133. package/types/Private/internal/LocalSpatialAudioEngineInternal.d.ts +1 -0
  134. package/types/Private/internal/LocalSpatialAudioEngineInternal.d.ts.map +1 -0
  135. package/types/Private/internal/MediaEngineInternal.d.ts +1 -0
  136. package/types/Private/internal/MediaEngineInternal.d.ts.map +1 -0
  137. package/types/Private/internal/MediaPlayerInternal.d.ts +1 -0
  138. package/types/Private/internal/MediaPlayerInternal.d.ts.map +1 -0
  139. package/types/Private/internal/MediaRecorderInternal.d.ts +1 -0
  140. package/types/Private/internal/MediaRecorderInternal.d.ts.map +1 -0
  141. package/types/Private/internal/MusicContentCenterInternal.d.ts +1 -0
  142. package/types/Private/internal/MusicContentCenterInternal.d.ts.map +1 -0
  143. package/types/Private/internal/RtcEngineExInternal.d.ts +3 -2
  144. package/types/Private/internal/RtcEngineExInternal.d.ts.map +1 -0
  145. package/{js → types}/Private/internal/emitter/EventEmitter.d.ts +1 -0
  146. package/types/Private/internal/emitter/EventEmitter.d.ts.map +1 -0
  147. package/types/Private/ti/AgoraBase-ti.d.ts +1 -0
  148. package/types/Private/ti/AgoraBase-ti.d.ts.map +1 -0
  149. package/types/Private/ti/AgoraMediaBase-ti.d.ts +1 -0
  150. package/types/Private/ti/AgoraMediaBase-ti.d.ts.map +1 -0
  151. package/types/Private/ti/AgoraMediaPlayerTypes-ti.d.ts +1 -0
  152. package/types/Private/ti/AgoraMediaPlayerTypes-ti.d.ts.map +1 -0
  153. package/types/Private/ti/IAgoraLog-ti.d.ts +1 -0
  154. package/types/Private/ti/IAgoraLog-ti.d.ts.map +1 -0
  155. package/types/Private/ti/IAgoraMediaEngine-ti.d.ts +1 -0
  156. package/types/Private/ti/IAgoraMediaEngine-ti.d.ts.map +1 -0
  157. package/types/Private/ti/IAgoraMediaPlayer-ti.d.ts +1 -0
  158. package/types/Private/ti/IAgoraMediaPlayer-ti.d.ts.map +1 -0
  159. package/types/Private/ti/IAgoraMediaPlayerSource-ti.d.ts +1 -0
  160. package/types/Private/ti/IAgoraMediaPlayerSource-ti.d.ts.map +1 -0
  161. package/types/Private/ti/IAgoraMediaRecorder-ti.d.ts +1 -0
  162. package/types/Private/ti/IAgoraMediaRecorder-ti.d.ts.map +1 -0
  163. package/types/Private/ti/IAgoraMediaStreamingSource-ti.d.ts +1 -0
  164. package/types/Private/ti/IAgoraMediaStreamingSource-ti.d.ts.map +1 -0
  165. package/types/Private/ti/IAgoraMusicContentCenter-ti.d.ts +1 -0
  166. package/types/Private/ti/IAgoraMusicContentCenter-ti.d.ts.map +1 -0
  167. package/types/Private/ti/IAgoraRhythmPlayer-ti.d.ts +1 -0
  168. package/types/Private/ti/IAgoraRhythmPlayer-ti.d.ts.map +1 -0
  169. package/types/Private/ti/IAgoraRtcEngine-ti.d.ts +1 -0
  170. package/types/Private/ti/IAgoraRtcEngine-ti.d.ts.map +1 -0
  171. package/types/Private/ti/IAgoraRtcEngineEx-ti.d.ts +1 -0
  172. package/types/Private/ti/IAgoraRtcEngineEx-ti.d.ts.map +1 -0
  173. package/types/Private/ti/IAgoraSpatialAudio-ti.d.ts +1 -0
  174. package/types/Private/ti/IAgoraSpatialAudio-ti.d.ts.map +1 -0
  175. package/types/Private/ti/IAudioDeviceManager-ti.d.ts +1 -0
  176. package/types/Private/ti/IAudioDeviceManager-ti.d.ts.map +1 -0
  177. package/types/Renderer/AgoraView.d.ts +1 -0
  178. package/types/Renderer/AgoraView.d.ts.map +1 -0
  179. package/types/Renderer/IRenderer.d.ts +6 -5
  180. package/types/Renderer/IRenderer.d.ts.map +1 -0
  181. package/types/Renderer/IRendererManager.d.ts +18 -0
  182. package/types/Renderer/IRendererManager.d.ts.map +1 -0
  183. package/types/Renderer/RendererManager.d.ts +5 -3
  184. package/types/Renderer/RendererManager.d.ts.map +1 -0
  185. package/types/Renderer/{GlRenderer → WebGLRenderer}/index.d.ts +9 -19
  186. package/types/Renderer/WebGLRenderer/index.d.ts.map +1 -0
  187. package/types/Renderer/WebGLRenderer/webgl-utils.d.ts +1 -0
  188. package/types/Renderer/WebGLRenderer/webgl-utils.d.ts.map +1 -0
  189. package/types/Renderer/YUVCanvasRenderer/index.d.ts +4 -4
  190. package/types/Renderer/YUVCanvasRenderer/index.d.ts.map +1 -0
  191. package/types/Renderer/index.d.ts +3 -0
  192. package/types/Renderer/index.d.ts.map +1 -0
  193. package/types/Types.d.ts +15 -9
  194. package/types/Types.d.ts.map +1 -0
  195. package/types/Utils.d.ts +1 -0
  196. package/types/Utils.d.ts.map +1 -0
  197. package/js/AgoraSdk.d.ts +0 -36
  198. package/js/Private/AgoraBase.d.ts +0 -4441
  199. package/js/Private/AgoraMediaBase.d.ts +0 -1124
  200. package/js/Private/AgoraMediaPlayerTypes.d.ts +0 -408
  201. package/js/Private/IAgoraLog.d.ts +0 -80
  202. package/js/Private/IAgoraMediaEngine.d.ts +0 -183
  203. package/js/Private/IAgoraMediaPlayer.d.ts +0 -532
  204. package/js/Private/IAgoraMediaPlayerSource.d.ts +0 -82
  205. package/js/Private/IAgoraMediaRecorder.d.ts +0 -28
  206. package/js/Private/IAgoraMediaStreamingSource.d.ts +0 -41
  207. package/js/Private/IAgoraMusicContentCenter.d.ts +0 -335
  208. package/js/Private/IAgoraRhythmPlayer.d.ts +0 -64
  209. package/js/Private/IAgoraRtcEngine.d.ts +0 -4947
  210. package/js/Private/IAgoraRtcEngineEx.d.ts +0 -553
  211. package/js/Private/IAgoraSpatialAudio.d.ts +0 -265
  212. package/js/Private/IAudioDeviceManager.d.ts +0 -254
  213. package/js/Private/extension/AgoraBaseExtension.d.ts +0 -1
  214. package/js/Private/extension/AgoraMediaBaseExtension.d.ts +0 -1
  215. package/js/Private/extension/AgoraMediaPlayerTypesExtension.d.ts +0 -1
  216. package/js/Private/extension/IAgoraLogExtension.d.ts +0 -1
  217. package/js/Private/extension/IAgoraMediaEngineExtension.d.ts +0 -40
  218. package/js/Private/extension/IAgoraMediaPlayerExtension.d.ts +0 -46
  219. package/js/Private/extension/IAgoraMediaPlayerSourceExtension.d.ts +0 -1
  220. package/js/Private/extension/IAgoraMediaRecorderExtension.d.ts +0 -44
  221. package/js/Private/extension/IAgoraMusicContentCenterExtension.d.ts +0 -20
  222. package/js/Private/extension/IAgoraRhythmPlayerExtension.d.ts +0 -1
  223. package/js/Private/extension/IAgoraRtcEngineExExtension.d.ts +0 -1
  224. package/js/Private/extension/IAgoraRtcEngineExtension.d.ts +0 -42
  225. package/js/Private/extension/IAgoraSpatialAudioExtension.d.ts +0 -1
  226. package/js/Private/extension/IAudioDeviceManagerExtension.d.ts +0 -1
  227. package/js/Private/impl/AgoraBaseImpl.d.ts +0 -2
  228. package/js/Private/impl/AgoraMediaBaseImpl.d.ts +0 -8
  229. package/js/Private/impl/IAgoraMediaEngineImpl.d.ts +0 -39
  230. package/js/Private/impl/IAgoraMediaPlayerImpl.d.ts +0 -140
  231. package/js/Private/impl/IAgoraMediaPlayerSourceImpl.d.ts +0 -2
  232. package/js/Private/impl/IAgoraMediaRecorderImpl.d.ts +0 -10
  233. package/js/Private/impl/IAgoraMusicContentCenterImpl.d.ts +0 -58
  234. package/js/Private/impl/IAgoraRtcEngineExImpl.d.ts +0 -105
  235. package/js/Private/impl/IAgoraRtcEngineImpl.d.ts +0 -570
  236. package/js/Private/impl/IAgoraSpatialAudioImpl.d.ts +0 -48
  237. package/js/Private/impl/IAudioDeviceManagerImpl.d.ts +0 -64
  238. package/js/Private/internal/AudioDeviceManagerInternal.d.ts +0 -8
  239. package/js/Private/internal/IrisApiEngine.d.ts +0 -147
  240. package/js/Private/internal/LocalSpatialAudioEngineInternal.d.ts +0 -18
  241. package/js/Private/internal/MediaEngineInternal.d.ts +0 -21
  242. package/js/Private/internal/MediaPlayerInternal.d.ts +0 -33
  243. package/js/Private/internal/MediaRecorderInternal.d.ts +0 -17
  244. package/js/Private/internal/MusicContentCenterInternal.d.ts +0 -39
  245. package/js/Private/internal/RtcEngineExInternal.d.ts +0 -80
  246. package/js/Private/ti/AgoraBase-ti.d.ts +0 -7
  247. package/js/Private/ti/AgoraMediaBase-ti.d.ts +0 -13
  248. package/js/Private/ti/AgoraMediaPlayerTypes-ti.d.ts +0 -6
  249. package/js/Private/ti/IAgoraLog-ti.d.ts +0 -6
  250. package/js/Private/ti/IAgoraMediaEngine-ti.d.ts +0 -6
  251. package/js/Private/ti/IAgoraMediaPlayer-ti.d.ts +0 -7
  252. package/js/Private/ti/IAgoraMediaPlayerSource-ti.d.ts +0 -7
  253. package/js/Private/ti/IAgoraMediaRecorder-ti.d.ts +0 -6
  254. package/js/Private/ti/IAgoraMediaStreamingSource-ti.d.ts +0 -6
  255. package/js/Private/ti/IAgoraMusicContentCenter-ti.d.ts +0 -7
  256. package/js/Private/ti/IAgoraRhythmPlayer-ti.d.ts +0 -6
  257. package/js/Private/ti/IAgoraRtcEngine-ti.d.ts +0 -9
  258. package/js/Private/ti/IAgoraRtcEngineEx-ti.d.ts +0 -6
  259. package/js/Private/ti/IAgoraSpatialAudio-ti.d.ts +0 -6
  260. package/js/Private/ti/IAudioDeviceManager-ti.d.ts +0 -6
  261. package/js/Renderer/AgoraView.d.ts +0 -69
  262. package/js/Renderer/GlRenderer/index.d.ts +0 -59
  263. package/js/Renderer/GlRenderer/webgl-utils.d.ts +0 -0
  264. package/js/Renderer/IRenderer.d.ts +0 -21
  265. package/js/Renderer/RendererManager.d.ts +0 -152
  266. package/js/Renderer/YUVCanvasRenderer/index.d.ts +0 -16
  267. package/js/Types.d.ts +0 -271
  268. package/js/Utils.d.ts +0 -58
  269. /package/js/Renderer/{GlRenderer → WebGLRenderer}/webgl-utils.js +0 -0
  270. /package/ts/Renderer/{GlRenderer → WebGLRenderer}/webgl-utils.js +0 -0
@@ -39,43 +39,45 @@ const yuvShaderSource = 'precision mediump float;' +
39
39
  ' gl_FragColor=vec4(r,g,b,1.0);' +
40
40
  '}';
41
41
  class GlRenderer extends IRenderer_1.IRenderer {
42
+ gl;
43
+ handleContextLost;
44
+ program;
45
+ positionLocation;
46
+ texCoordLocation;
47
+ yTexture;
48
+ uTexture;
49
+ vTexture;
50
+ texCoordBuffer;
51
+ surfaceBuffer;
52
+ // @ts-ignore
53
+ parentElement;
54
+ container;
55
+ // @ts-ignore
56
+ canvas;
57
+ renderImageCount = 0;
58
+ initWidth = 0;
59
+ initHeight = 0;
60
+ initRotation = 0;
61
+ clientWidth = 0;
62
+ clientHeight = 0;
63
+ contentMode = 0;
64
+ event = new events_1.EventEmitter();
65
+ firstFrameRender = false;
66
+ lastImageWidth = 0;
67
+ lastImageHeight = 0;
68
+ lastImageRotation = 0;
69
+ videoBuffer = {};
70
+ observer;
71
+ failInitRenderCB;
42
72
  constructor(failCallback) {
43
73
  super();
44
- this.renderImageCount = 0;
45
- this.initWidth = 0;
46
- this.initHeight = 0;
47
- this.initRotation = 0;
48
- this.clientWidth = 0;
49
- this.clientHeight = 0;
50
- this.contentMode = 0;
51
- this.event = new events_1.EventEmitter();
52
- this.firstFrameRender = false;
53
- this.lastImageWidth = 0;
54
- this.lastImageHeight = 0;
55
- this.lastImageRotation = 0;
56
- this.videoBuffer = {};
57
74
  this.failInitRenderCB = failCallback;
58
75
  }
59
76
  bind(view) {
60
77
  super.bind(view);
61
- // this.initCanvas(
62
- // view,
63
- // view.clientWidth,
64
- // view.clientHeight,
65
- // this.initRotation,
66
- // console.warn
67
- // );
68
- // const ResizeObserver = window.ResizeObserver;
69
- // if (ResizeObserver) {
70
- // this.observer = new ResizeObserver(() => {
71
- // this.refreshCanvas && this.refreshCanvas();
72
- // });
73
- // this.observer.observe(view);
74
- // }
75
78
  }
76
79
  unbind() {
77
- // @ts-ignore
78
- this.observer && this.observer.unobserve && this.observer.disconnect();
80
+ this.observer?.unobserve && this.observer.disconnect();
79
81
  this.program = undefined;
80
82
  this.positionLocation = undefined;
81
83
  this.texCoordLocation = undefined;
@@ -120,46 +122,38 @@ class GlRenderer extends IRenderer_1.IRenderer {
120
122
  // Cover
121
123
  if (rotation === 0 || rotation === 180) {
122
124
  if (this.clientWidth / this.clientHeight > width / height) {
123
- // @ts-ignore
124
- this.canvas.style.zoom = this.clientWidth / width;
125
+ this.canvas.style.transform = `scale(${this.clientWidth / width})`;
125
126
  }
126
127
  else {
127
- // @ts-ignore
128
- this.canvas.style.zoom = this.clientHeight / height;
128
+ this.canvas.style.transform = `scale(${this.clientHeight / height})`;
129
129
  }
130
130
  }
131
131
  else {
132
132
  // 90, 270
133
133
  if (this.clientHeight / this.clientWidth > width / height) {
134
- // @ts-ignore
135
- this.canvas.style.zoom = this.clientHeight / width;
134
+ this.canvas.style.transform = `scale(${this.clientHeight / width})`;
136
135
  }
137
136
  else {
138
- // @ts-ignore
139
- this.canvas.style.zoom = this.clientWidth / height;
137
+ this.canvas.style.transform = `scale(${this.clientWidth / height})`;
140
138
  }
141
139
  }
142
140
  // Contain
143
141
  }
144
142
  else if (rotation === 0 || rotation === 180) {
145
143
  if (this.clientWidth / this.clientHeight > width / height) {
146
- // @ts-ignore
147
- this.canvas.style.zoom = this.clientHeight / height;
144
+ this.canvas.style.transform = `scale(${this.clientHeight / height})`;
148
145
  }
149
146
  else {
150
- // @ts-ignore
151
- this.canvas.style.zoom = this.clientWidth / width;
147
+ this.canvas.style.transform = `scale(${this.clientWidth / width})`;
152
148
  }
153
149
  }
154
150
  else {
155
151
  // 90, 270
156
152
  if (this.clientHeight / this.clientWidth > width / height) {
157
- // @ts-ignore
158
- this.canvas.style.zoom = this.clientWidth / height;
153
+ this.canvas.style.transform = `scale(${this.clientWidth / height})`;
159
154
  }
160
155
  else {
161
- // @ts-ignore
162
- this.canvas.style.zoom = this.clientHeight / width;
156
+ this.canvas.style.transform = `scale(${this.clientHeight / width})`;
163
157
  }
164
158
  }
165
159
  }
@@ -13,6 +13,10 @@ const isEqual = require('lodash.isequal');
13
13
  const YUVBuffer = require('yuv-buffer');
14
14
  const YUVCanvas = require('yuv-canvas');
15
15
  class YUVCanvasRenderer extends IRenderer_1.IRenderer {
16
+ _cacheCanvasOptions;
17
+ _yuvCanvasSink;
18
+ _container;
19
+ _videoFrame;
16
20
  constructor() {
17
21
  super();
18
22
  this._videoFrame = {
@@ -46,7 +50,6 @@ class YUVCanvasRenderer extends IRenderer_1.IRenderer {
46
50
  });
47
51
  }
48
52
  unbind() {
49
- var _a, _b;
50
53
  if (this._container) {
51
54
  this._container.replaceChildren();
52
55
  this._container = undefined;
@@ -58,8 +61,8 @@ class YUVCanvasRenderer extends IRenderer_1.IRenderer {
58
61
  if (this.canvas) {
59
62
  this.canvas = undefined;
60
63
  }
61
- if (this._yuvCanvasSink && ((_a = this._yuvCanvasSink) === null || _a === void 0 ? void 0 : _a.loseContext)) {
62
- (_b = this._yuvCanvasSink) === null || _b === void 0 ? void 0 : _b.loseContext();
64
+ if (this._yuvCanvasSink && this._yuvCanvasSink?.loseContext) {
65
+ this._yuvCanvasSink?.loseContext();
63
66
  }
64
67
  }
65
68
  zoom(vertical, contentMode = AgoraMediaBase_1.RenderModeType.RenderModeFit, width, height, clientWidth, clientHeight) {
@@ -127,11 +130,9 @@ class YUVCanvasRenderer extends IRenderer_1.IRenderer {
127
130
  let transformItems = [];
128
131
  transformItems.push(`rotateZ(${options.rotation}deg)`);
129
132
  let scale = this.zoom(options.rotation === 90 || options.rotation === 270, options.contentMode, options.frameWidth, options.frameHeight, options.clientWidth, options.clientHeight);
130
- // @ts-ignore
131
- this.canvas.style.zoom = scale.toString();
133
+ this.canvas.style.transform = `scale(${scale.toString()})`;
132
134
  if (transformItems.length > 0) {
133
- let transform = `${transformItems.join(' ')}`;
134
- this.canvas.style.transform = transform;
135
+ this.canvas.style.transform = `${transformItems.join(' ')}`;
135
136
  }
136
137
  }
137
138
  }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./IRenderer"), exports);
18
+ __exportStar(require("./IRendererManager"), exports);
package/js/Utils.js CHANGED
@@ -91,7 +91,7 @@ exports.objsKeysToLowerCase = objsKeysToLowerCase;
91
91
  */
92
92
  const formatConfigByVideoSourceType = (videoSourceType, originChannelId = '', originUid = 0) => {
93
93
  if (videoSourceType === undefined || videoSourceType === null) {
94
- throw new Error(`must set videoSourceType`);
94
+ throw new Error(`must set videoSourceType:${videoSourceType}`);
95
95
  }
96
96
  let uid = originUid;
97
97
  let channelId = originChannelId;
@@ -106,13 +106,13 @@ const formatConfigByVideoSourceType = (videoSourceType, originChannelId = '', or
106
106
  break;
107
107
  case AgoraMediaBase_1.VideoSourceType.VideoSourceRemote:
108
108
  if (!uid || !channelId) {
109
- throw new Error(`must set uid:${uid}} and channelId:${channelId}`);
109
+ throw new Error(`must set uid:${uid} and channelId:${channelId}`);
110
110
  }
111
111
  break;
112
112
  case AgoraMediaBase_1.VideoSourceType.VideoSourceMediaPlayer:
113
113
  channelId = '';
114
114
  if (!uid) {
115
- throw new Error(`must set uid(mediaPlayerId):${uid}}}`);
115
+ throw new Error(`must set mediaPlayerId:${uid}`);
116
116
  }
117
117
  break;
118
118
  default:
@@ -125,10 +125,9 @@ exports.formatConfigByVideoSourceType = formatConfigByVideoSourceType;
125
125
  * @ignore
126
126
  */
127
127
  const getDefaultRendererVideoConfig = (config) => {
128
- var _a, _b;
129
- const rendererOptions = Object.assign({}, (_b = (_a = exports.AgoraEnv.AgoraRendererManager) === null || _a === void 0 ? void 0 : _a.defaultRenderConfig) === null || _b === void 0 ? void 0 : _b.rendererOptions, config.rendererOptions);
128
+ const rendererOptions = Object.assign({}, exports.AgoraEnv.AgoraRendererManager?.defaultRenderConfig?.rendererOptions, config.rendererOptions);
130
129
  const { uid, channelId, videoSourceType } = (0, exports.formatConfigByVideoSourceType)(config.videoSourceType, config.channelId, config.uid);
131
- return Object.assign(Object.assign({}, config), { uid, channelId, videoSourceType, rendererOptions });
130
+ return { ...config, uid, channelId, videoSourceType, rendererOptions };
132
131
  };
133
132
  exports.getDefaultRendererVideoConfig = getDefaultRendererVideoConfig;
134
133
  /**
@@ -164,7 +163,6 @@ const agora = require('../build/Release/agora_node_ext');
164
163
  exports.AgoraEnv = {
165
164
  enableLogging: true,
166
165
  enableDebugLogging: false,
166
+ webEnvReady: true,
167
167
  AgoraElectronBridge: new agora.AgoraElectronBridge(),
168
168
  };
169
- // @ts-ignore
170
- (window || global).AgoraEnv = exports.AgoraEnv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-electron-sdk",
3
- "version": "4.2.0-dev.4",
3
+ "version": "4.2.0-dev.8",
4
4
  "description": "agora-electron-sdk",
5
5
  "main": "js/AgoraSdk",
6
6
  "types": "types/AgoraSdk.d.ts",
@@ -59,6 +59,7 @@
59
59
  "@commitlint/config-conventional": "^17.0.2",
60
60
  "@evilmartians/lefthook": "^1.2.2",
61
61
  "@release-it/conventional-changelog": "^5.0.0",
62
+ "@types/json-bigint": "^1.0.1",
62
63
  "@typescript-eslint/eslint-plugin": "^5.30.5",
63
64
  "@typescript-eslint/parser": "^5.30.5",
64
65
  "cmake-js": "6.3.2",
@@ -77,7 +78,7 @@
77
78
  "typescript": "^4.5.2"
78
79
  },
79
80
  "engines": {
80
- "node": ">= 16.0.0"
81
+ "node": ">= 14.0.0"
81
82
  },
82
83
  "packageManager": "^yarn@1.22.15",
83
84
  "commitlint": {
@@ -230,7 +231,7 @@
230
231
  "yuv-canvas": "1.2.6"
231
232
  },
232
233
  "agora_electron": {
233
- "iris_sdk_win": "https://download.agora.io/sdk/release/iris_4.2.0-dev.4_DCG_Windows_Video_20230410_1051.zip",
234
- "iris_sdk_mac": "https://download.agora.io/sdk/release/iris_4.2.0-dev.4_DCG_Mac_Video_20230410_1051.zip"
234
+ "iris_sdk_win": "https://download.agora.io/sdk/release/iris_4.2.0-dev.8_DCG_Windows_Video_20230417_1118.zip",
235
+ "iris_sdk_mac": "https://download.agora.io/sdk/release/iris_4.2.0-dev.8_DCG_Mac_Video_20230417_1121.zip"
235
236
  }
236
237
  }
@@ -7,8 +7,7 @@ const buildJS = async (cb) => {
7
7
  logger.info('Build js from typescript');
8
8
  await cleanJSDir();
9
9
  await cleanTypesDir();
10
- await exec('tsc', { silent: false });
11
- await exec('tsc -p dtsconfig.json', { silent: false });
10
+ await exec('tsc -p tsconfig.build.json', { silent: false });
12
11
  cb();
13
12
  };
14
13
 
@@ -4,7 +4,6 @@ const minimist = require('minimist');
4
4
 
5
5
  const logger = require('./logger');
6
6
 
7
- //@ts-ignore
8
7
  const { INIT_CWD } = minimist(process.argv.slice(2), {
9
8
  string: ['INIT_CWD'],
10
9
  default: {},
package/ts/AgoraSdk.ts CHANGED
@@ -2,6 +2,8 @@ import { IMediaPlayerCacheManager } from './Private/IAgoraMediaPlayer';
2
2
  import { IRtcEngineEx } from './Private/IAgoraRtcEngineEx';
3
3
  import { IMediaPlayerCacheManagerImpl } from './Private/impl/IAgoraMediaPlayerImpl';
4
4
  import { RtcEngineExInternal } from './Private/internal/RtcEngineExInternal';
5
+ import { AgoraEnvOptions } from './Types';
6
+ import { AgoraEnv } from './Utils';
5
7
 
6
8
  export * from './Private/AgoraBase';
7
9
  export * from './Private/AgoraMediaBase';
@@ -17,7 +19,7 @@ export * from './Private/IAgoraRtcEngine';
17
19
  export * from './Private/IAgoraRtcEngineEx';
18
20
  export * from './Private/IAgoraSpatialAudio';
19
21
  export * from './Private/IAudioDeviceManager';
20
- export * from './Renderer/RendererManager';
22
+ export * from './Renderer';
21
23
  export * from './Types';
22
24
  export * from './Utils';
23
25
 
@@ -30,7 +32,8 @@ const instance = new RtcEngineExInternal();
30
32
  * @returns
31
33
  * One IRtcEngine object.
32
34
  */
33
- export function createAgoraRtcEngine(): IRtcEngineEx {
35
+ export function createAgoraRtcEngine(options?: AgoraEnvOptions): IRtcEngineEx {
36
+ Object.assign(AgoraEnv, options);
34
37
  return instance;
35
38
  }
36
39
 
@@ -312,6 +312,51 @@ export abstract class IMediaPlayer {
312
312
  observer: IMediaPlayerSourceObserver
313
313
  ): number;
314
314
 
315
+ /**
316
+ * Registers an audio frame observer object.
317
+ *
318
+ * @param mode The use mode of the audio frame. See RawAudioFrameOpModeType .
319
+ */
320
+ abstract registerAudioFrameObserver(
321
+ observer: IAudioPcmFrameSink,
322
+ mode?: RawAudioFrameOpModeType
323
+ ): number;
324
+
325
+ /**
326
+ * Unregisters an audio observer.
327
+ *
328
+ * @param observer The audio observer. See IMediaPlayerAudioFrameObserver .
329
+ *
330
+ * @returns
331
+ * 0: Success.< 0: Failure.
332
+ */
333
+ abstract unregisterAudioFrameObserver(observer: IAudioPcmFrameSink): number;
334
+
335
+ /**
336
+ * Registers a video frame observer object.
337
+ * You need to implement the IMediaPlayerVideoFrameObserver class in this method and register callbacks according to your scenarios. After you successfully register the video frame observer, the SDK triggers the registered callbacks each time a video frame is received.
338
+ *
339
+ * @param observer The video observer, reporting the reception of each video frame. See IMediaPlayerVideoFrameObserver .
340
+ *
341
+ * @returns
342
+ * 0: Success.< 0: Failure.
343
+ */
344
+ abstract registerVideoFrameObserver(
345
+ observer: IMediaPlayerVideoFrameObserver
346
+ ): number;
347
+
348
+ /**
349
+ * Unregisters the video frame observer.
350
+ *
351
+ * @param observer The video observer, reporting the reception of each video frame. See IMediaPlayerVideoFrameObserver .
352
+ *
353
+ * @returns
354
+ * 0: Success.< 0: Failure.
355
+ */
356
+ abstract unregisterVideoFrameObserver(
357
+ observer: IMediaPlayerVideoFrameObserver
358
+ ): number;
359
+
315
360
  /**
316
361
  * @ignore
317
362
  */
@@ -447,51 +492,6 @@ export abstract class IMediaPlayer {
447
492
  * @ignore
448
493
  */
449
494
  abstract setSoundPositionParams(pan: number, gain: number): number;
450
-
451
- /**
452
- * Registers an audio frame observer object.
453
- *
454
- * @param mode The use mode of the audio frame. See RawAudioFrameOpModeType .
455
- */
456
- abstract registerAudioFrameObserver(
457
- observer: IAudioPcmFrameSink,
458
- mode?: RawAudioFrameOpModeType
459
- ): number;
460
-
461
- /**
462
- * Unregisters an audio observer.
463
- *
464
- * @param observer The audio observer. See IMediaPlayerAudioFrameObserver .
465
- *
466
- * @returns
467
- * 0: Success.< 0: Failure.
468
- */
469
- abstract unregisterAudioFrameObserver(observer: IAudioPcmFrameSink): number;
470
-
471
- /**
472
- * Registers a video frame observer object.
473
- * You need to implement the IMediaPlayerVideoFrameObserver class in this method and register callbacks according to your scenarios. After you successfully register the video frame observer, the SDK triggers the registered callbacks each time a video frame is received.
474
- *
475
- * @param observer The video observer, reporting the reception of each video frame. See IMediaPlayerVideoFrameObserver .
476
- *
477
- * @returns
478
- * 0: Success.< 0: Failure.
479
- */
480
- abstract registerVideoFrameObserver(
481
- observer: IMediaPlayerVideoFrameObserver
482
- ): number;
483
-
484
- /**
485
- * Unregisters the video frame observer.
486
- *
487
- * @param observer The video observer, reporting the reception of each video frame. See IMediaPlayerVideoFrameObserver .
488
- *
489
- * @returns
490
- * 0: Success.< 0: Failure.
491
- */
492
- abstract unregisterVideoFrameObserver(
493
- observer: IMediaPlayerVideoFrameObserver
494
- ): number;
495
495
  }
496
496
 
497
497
  /**
@@ -1087,9 +1087,9 @@ export class ChannelMediaOptions {
1087
1087
  */
1088
1088
  publishMediaPlayerVideoTrack?: boolean;
1089
1089
  /**
1090
- * Whether to publish the local transcoded video:true: Publish the local transcoded video.false: (Default) Do not publish the local transcoded video.
1090
+ * @ignore
1091
1091
  */
1092
- publishTrancodedVideoTrack?: boolean;
1092
+ publishTranscodedVideoTrack?: boolean;
1093
1093
  /**
1094
1094
  * Whether to automatically subscribe to all remote audio streams when the user joins a channel:true: (Default) Automatically subscribe to all remote audio streams.false: Do not automatically subscribe to any remote audio streams.
1095
1095
  */
@@ -4796,7 +4796,7 @@ export abstract class IRtcEngine {
4796
4796
  /**
4797
4797
  * @ignore
4798
4798
  */
4799
- abstract startScreenCaptureDesktop(
4799
+ abstract startScreenCaptureBySourceType(
4800
4800
  sourceType: VideoSourceType,
4801
4801
  config: ScreenCaptureConfiguration
4802
4802
  ): number;
@@ -4830,6 +4830,14 @@ export abstract class IRtcEngine {
4830
4830
  */
4831
4831
  abstract setScreenCaptureScenario(screenScenario: ScreenScenarioType): number;
4832
4832
 
4833
+ /**
4834
+ * Stops screen sharing.
4835
+ *
4836
+ * @returns
4837
+ * 0: Success.< 0: Failure.
4838
+ */
4839
+ abstract stopScreenCapture(): number;
4840
+
4833
4841
  /**
4834
4842
  * Stops the local video preview.
4835
4843
  * After calling startPreview to start the preview, if you want to close the local video preview, call this method.Call this method before joining a channel or after leaving a channel.
@@ -4839,7 +4847,7 @@ export abstract class IRtcEngine {
4839
4847
  * @returns
4840
4848
  * < 0: Failure.
4841
4849
  */
4842
- abstract stopScreenCapture(sourceType?: VideoSourceType): number;
4850
+ abstract stopScreenCaptureBySourceType(sourceType: VideoSourceType): number;
4843
4851
 
4844
4852
  /**
4845
4853
  * Retrieves the call ID.
@@ -5590,27 +5598,7 @@ export abstract class IRtcEngine {
5590
5598
  /**
5591
5599
  * @ignore
5592
5600
  */
5593
- abstract getNtpTimeInMs(): number;
5594
-
5595
- /**
5596
- * Destroys a video renderer object.
5597
- *
5598
- * @param view The HTMLElement object to be destroyed.
5599
- */
5600
- abstract destroyRendererByView(view: any): void;
5601
-
5602
- /**
5603
- * Destroys multiple video renderer objects at one time.
5604
- *
5605
- * @param sourceType The type of the video frame, see VideoSourceType .
5606
- * @param channelId The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters:All lowercase English letters: a to z.All uppercase English letters: A to Z.All numeric characters: 0 to 9.Space"!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "= ", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
5607
- * @param uid The user ID of the remote user.
5608
- */
5609
- abstract destroyRendererByConfig(
5610
- sourceType: VideoSourceType,
5611
- channelId?: string,
5612
- uid?: number
5613
- ): void;
5601
+ abstract getNtpWallTimeInMs(): number;
5614
5602
 
5615
5603
  /**
5616
5604
  * Gets the IAudioDeviceManager object to manage audio devices.
@@ -5680,6 +5668,26 @@ export abstract class IRtcEngine {
5680
5668
  */
5681
5669
  abstract setMaxMetadataSize(size: number): number;
5682
5670
 
5671
+ /**
5672
+ * Destroys a video renderer object.
5673
+ *
5674
+ * @param view The HTMLElement object to be destroyed.
5675
+ */
5676
+ abstract destroyRendererByView(view: any): void;
5677
+
5678
+ /**
5679
+ * Destroys multiple video renderer objects at one time.
5680
+ *
5681
+ * @param sourceType The type of the video frame, see VideoSourceType .
5682
+ * @param channelId The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters:All lowercase English letters: a to z.All uppercase English letters: A to Z.All numeric characters: 0 to 9.Space"!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "= ", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
5683
+ * @param uid The user ID of the remote user.
5684
+ */
5685
+ abstract destroyRendererByConfig(
5686
+ sourceType: VideoSourceType,
5687
+ channelId?: string,
5688
+ uid?: number
5689
+ ): void;
5690
+
5683
5691
  /**
5684
5692
  * Unregisters the encoded audio frame observer.
5685
5693
  *