agora-electron-sdk 0.0.0-dev.1
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 +315 -0
- package/LICENSE +21 -0
- package/README.md +143 -0
- package/gulpfile.js +52 -0
- package/js/AgoraSdk.js +64 -0
- package/js/Decoder/gpu-utils.js +74 -0
- package/js/Decoder/index.js +172 -0
- package/js/Private/AgoraBase.js +3985 -0
- package/js/Private/AgoraMediaBase.js +1014 -0
- package/js/Private/AgoraMediaPlayerTypes.js +316 -0
- package/js/Private/IAgoraH265Transcoder.js +36 -0
- package/js/Private/IAgoraLog.js +78 -0
- package/js/Private/IAgoraMediaEngine.js +32 -0
- package/js/Private/IAgoraMediaPlayer.js +16 -0
- package/js/Private/IAgoraMediaPlayerSource.js +3 -0
- package/js/Private/IAgoraMediaRecorder.js +10 -0
- package/js/Private/IAgoraMediaStreamingSource.js +74 -0
- package/js/Private/IAgoraMusicContentCenter.js +157 -0
- package/js/Private/IAgoraRhythmPlayer.js +62 -0
- package/js/Private/IAgoraRtcEngine.js +982 -0
- package/js/Private/IAgoraRtcEngineEx.js +19 -0
- package/js/Private/IAgoraSpatialAudio.js +24 -0
- package/js/Private/IAudioDeviceManager.js +20 -0
- package/js/Private/extension/AgoraBaseExtension.js +3 -0
- package/js/Private/extension/AgoraMediaBaseExtension.js +2 -0
- package/js/Private/extension/AgoraMediaPlayerTypesExtension.js +2 -0
- package/js/Private/extension/IAgoraH265TranscoderExtension.js +2 -0
- package/js/Private/extension/IAgoraLogExtension.js +2 -0
- package/js/Private/extension/IAgoraMediaEngineExtension.js +2 -0
- package/js/Private/extension/IAgoraMediaPlayerExtension.js +2 -0
- package/js/Private/extension/IAgoraMediaPlayerSourceExtension.js +2 -0
- package/js/Private/extension/IAgoraMediaRecorderExtension.js +2 -0
- package/js/Private/extension/IAgoraMusicContentCenterExtension.js +2 -0
- package/js/Private/extension/IAgoraRhythmPlayerExtension.js +2 -0
- package/js/Private/extension/IAgoraRtcEngineExExtension.js +2 -0
- package/js/Private/extension/IAgoraRtcEngineExtension.js +2 -0
- package/js/Private/extension/IAgoraSpatialAudioExtension.js +2 -0
- package/js/Private/extension/IAudioDeviceManagerExtension.js +2 -0
- package/js/Private/impl/AgoraBaseImpl.js +23 -0
- package/js/Private/impl/AgoraMediaBaseImpl.js +149 -0
- package/js/Private/impl/IAgoraH265TranscoderImpl.js +116 -0
- package/js/Private/impl/IAgoraMediaEngineImpl.js +337 -0
- package/js/Private/impl/IAgoraMediaPlayerImpl.js +950 -0
- package/js/Private/impl/IAgoraMediaPlayerSourceImpl.js +73 -0
- package/js/Private/impl/IAgoraMediaRecorderImpl.js +47 -0
- package/js/Private/impl/IAgoraMusicContentCenterImpl.js +422 -0
- package/js/Private/impl/IAgoraRtcEngineExImpl.js +1042 -0
- package/js/Private/impl/IAgoraRtcEngineImpl.js +5167 -0
- package/js/Private/impl/IAgoraSpatialAudioImpl.js +358 -0
- package/js/Private/impl/IAudioDeviceManagerImpl.js +375 -0
- package/js/Private/internal/AgoraH265TranscoderInternal.js +62 -0
- package/js/Private/internal/AgoraMediaBaseInternal.js +15 -0
- package/js/Private/internal/AudioDeviceManagerInternal.js +44 -0
- package/js/Private/internal/IrisApiEngine.js +424 -0
- package/js/Private/internal/LocalSpatialAudioEngineInternal.js +7 -0
- package/js/Private/internal/MediaEngineInternal.js +122 -0
- package/js/Private/internal/MediaPlayerInternal.js +194 -0
- package/js/Private/internal/MediaRecorderInternal.js +70 -0
- package/js/Private/internal/MusicContentCenterInternal.js +139 -0
- package/js/Private/internal/RtcEngineExInternal.js +430 -0
- package/js/Private/ipc/main.js +21 -0
- package/js/Private/ipc/renderer.js +21 -0
- package/js/Private/ti/AgoraBase-ti.js +40 -0
- package/js/Private/ti/AgoraMediaBase-ti.js +75 -0
- package/js/Private/ti/AgoraMediaPlayerTypes-ti.js +5 -0
- package/js/Private/ti/IAgoraH265Transcoder-ti.js +40 -0
- package/js/Private/ti/IAgoraLog-ti.js +5 -0
- package/js/Private/ti/IAgoraMediaEngine-ti.js +5 -0
- package/js/Private/ti/IAgoraMediaPlayer-ti.js +38 -0
- package/js/Private/ti/IAgoraMediaPlayerSource-ti.js +50 -0
- package/js/Private/ti/IAgoraMediaRecorder-ti.js +5 -0
- package/js/Private/ti/IAgoraMediaStreamingSource-ti.js +5 -0
- package/js/Private/ti/IAgoraMusicContentCenter-ti.js +42 -0
- package/js/Private/ti/IAgoraRhythmPlayer-ti.js +5 -0
- package/js/Private/ti/IAgoraRtcEngine-ti.js +141 -0
- package/js/Private/ti/IAgoraRtcEngineEx-ti.js +5 -0
- package/js/Private/ti/IAgoraSpatialAudio-ti.js +5 -0
- package/js/Private/ti/IAudioDeviceManager-ti.js +5 -0
- package/js/Renderer/AgoraView.js +161 -0
- package/js/Renderer/CapabilityManager.js +99 -0
- package/js/Renderer/IRenderer.js +136 -0
- package/js/Renderer/IRendererCache.js +75 -0
- package/js/Renderer/RendererCache.js +100 -0
- package/js/Renderer/RendererManager.js +301 -0
- package/js/Renderer/WebCodecsRenderer/index.js +109 -0
- package/js/Renderer/WebCodecsRendererCache.js +115 -0
- package/js/Renderer/WebGLRenderer/index.js +314 -0
- package/js/Renderer/WebGLRenderer/webgl-utils.js +1337 -0
- package/js/Renderer/YUVCanvasRenderer/index.js +46 -0
- package/js/Renderer/index.js +17 -0
- package/js/Types.js +67 -0
- package/js/Utils.js +187 -0
- package/package.json +167 -0
- package/scripts/bootstrap.js +29 -0
- package/scripts/build.js +37 -0
- package/scripts/buildJS.js +14 -0
- package/scripts/checkElectron.js +43 -0
- package/scripts/clean.js +16 -0
- package/scripts/download.js +105 -0
- package/scripts/downloadPrebuild.js +199 -0
- package/scripts/getConfig.js +73 -0
- package/scripts/logger.js +32 -0
- package/scripts/synclib.js +69 -0
- package/scripts/util.js +47 -0
- package/scripts/zipBuild.js +40 -0
- package/ts/AgoraSdk.ts +54 -0
- package/ts/Decoder/gpu-utils.ts +92 -0
- package/ts/Decoder/index.ts +206 -0
- package/ts/Private/AgoraBase.ts +5511 -0
- package/ts/Private/AgoraMediaBase.ts +1764 -0
- package/ts/Private/AgoraMediaPlayerTypes.ts +464 -0
- package/ts/Private/IAgoraH265Transcoder.ts +73 -0
- package/ts/Private/IAgoraLog.ts +91 -0
- package/ts/Private/IAgoraMediaEngine.ts +316 -0
- package/ts/Private/IAgoraMediaPlayer.ts +744 -0
- package/ts/Private/IAgoraMediaPlayerSource.ts +137 -0
- package/ts/Private/IAgoraMediaRecorder.ts +25 -0
- package/ts/Private/IAgoraMediaStreamingSource.ts +81 -0
- package/ts/Private/IAgoraMusicContentCenter.ts +455 -0
- package/ts/Private/IAgoraRhythmPlayer.ts +67 -0
- package/ts/Private/IAgoraRtcEngine.ts +7306 -0
- package/ts/Private/IAgoraRtcEngineEx.ts +992 -0
- package/ts/Private/IAgoraSpatialAudio.ts +250 -0
- package/ts/Private/IAudioDeviceManager.ts +342 -0
- package/ts/Private/extension/AgoraBaseExtension.ts +14 -0
- package/ts/Private/extension/AgoraMediaBaseExtension.ts +1 -0
- package/ts/Private/extension/AgoraMediaPlayerTypesExtension.ts +1 -0
- package/ts/Private/extension/IAgoraH265TranscoderExtension.ts +39 -0
- package/ts/Private/extension/IAgoraLogExtension.ts +1 -0
- package/ts/Private/extension/IAgoraMediaEngineExtension.ts +62 -0
- package/ts/Private/extension/IAgoraMediaPlayerExtension.ts +64 -0
- package/ts/Private/extension/IAgoraMediaPlayerSourceExtension.ts +1 -0
- package/ts/Private/extension/IAgoraMediaRecorderExtension.ts +59 -0
- package/ts/Private/extension/IAgoraMusicContentCenterExtension.ts +34 -0
- package/ts/Private/extension/IAgoraRhythmPlayerExtension.ts +1 -0
- package/ts/Private/extension/IAgoraRtcEngineExExtension.ts +1 -0
- package/ts/Private/extension/IAgoraRtcEngineExtension.ts +64 -0
- package/ts/Private/extension/IAgoraSpatialAudioExtension.ts +1 -0
- package/ts/Private/extension/IAudioDeviceManagerExtension.ts +1 -0
- package/ts/Private/impl/AgoraBaseImpl.ts +39 -0
- package/ts/Private/impl/AgoraMediaBaseImpl.ts +237 -0
- package/ts/Private/impl/IAgoraH265TranscoderImpl.ts +152 -0
- package/ts/Private/impl/IAgoraMediaEngineImpl.ts +491 -0
- package/ts/Private/impl/IAgoraMediaPlayerImpl.ts +1169 -0
- package/ts/Private/impl/IAgoraMediaPlayerSourceImpl.ts +94 -0
- package/ts/Private/impl/IAgoraMediaRecorderImpl.ts +59 -0
- package/ts/Private/impl/IAgoraMusicContentCenterImpl.ts +562 -0
- package/ts/Private/impl/IAgoraRtcEngineExImpl.ts +1672 -0
- package/ts/Private/impl/IAgoraRtcEngineImpl.ts +7352 -0
- package/ts/Private/impl/IAgoraSpatialAudioImpl.ts +495 -0
- package/ts/Private/impl/IAudioDeviceManagerImpl.ts +443 -0
- package/ts/Private/internal/AgoraH265TranscoderInternal.ts +97 -0
- package/ts/Private/internal/AgoraMediaBaseInternal.ts +15 -0
- package/ts/Private/internal/AudioDeviceManagerInternal.ts +46 -0
- package/ts/Private/internal/IrisApiEngine.ts +598 -0
- package/ts/Private/internal/LocalSpatialAudioEngineInternal.ts +3 -0
- package/ts/Private/internal/MediaEngineInternal.ts +190 -0
- package/ts/Private/internal/MediaPlayerInternal.ts +311 -0
- package/ts/Private/internal/MediaRecorderInternal.ts +100 -0
- package/ts/Private/internal/MusicContentCenterInternal.ts +208 -0
- package/ts/Private/internal/RtcEngineExInternal.ts +647 -0
- package/ts/Private/ipc/main.ts +22 -0
- package/ts/Private/ipc/renderer.ts +21 -0
- package/ts/Private/ti/AgoraBase-ti.ts +16 -0
- package/ts/Private/ti/AgoraMediaBase-ti.ts +58 -0
- package/ts/Private/ti/AgoraMediaPlayerTypes-ti.ts +11 -0
- package/ts/Private/ti/IAgoraH265Transcoder-ti.ts +16 -0
- package/ts/Private/ti/IAgoraLog-ti.ts +11 -0
- package/ts/Private/ti/IAgoraMediaEngine-ti.ts +11 -0
- package/ts/Private/ti/IAgoraMediaPlayer-ti.ts +14 -0
- package/ts/Private/ti/IAgoraMediaPlayerSource-ti.ts +26 -0
- package/ts/Private/ti/IAgoraMediaRecorder-ti.ts +11 -0
- package/ts/Private/ti/IAgoraMediaStreamingSource-ti.ts +11 -0
- package/ts/Private/ti/IAgoraMusicContentCenter-ti.ts +18 -0
- package/ts/Private/ti/IAgoraRhythmPlayer-ti.ts +11 -0
- package/ts/Private/ti/IAgoraRtcEngine-ti.ts +119 -0
- package/ts/Private/ti/IAgoraRtcEngineEx-ti.ts +11 -0
- package/ts/Private/ti/IAgoraSpatialAudio-ti.ts +11 -0
- package/ts/Private/ti/IAudioDeviceManager-ti.ts +11 -0
- package/ts/Renderer/AgoraView.ts +235 -0
- package/ts/Renderer/CapabilityManager.ts +126 -0
- package/ts/Renderer/IRenderer.ts +158 -0
- package/ts/Renderer/IRendererCache.ts +96 -0
- package/ts/Renderer/RendererCache.ts +124 -0
- package/ts/Renderer/RendererManager.ts +400 -0
- package/ts/Renderer/WebCodecsRenderer/index.ts +145 -0
- package/ts/Renderer/WebCodecsRendererCache.ts +137 -0
- package/ts/Renderer/WebGLRenderer/index.ts +489 -0
- package/ts/Renderer/WebGLRenderer/webgl-utils.js +1510 -0
- package/ts/Renderer/YUVCanvasRenderer/index.ts +67 -0
- package/ts/Renderer/index.ts +1 -0
- package/ts/Types.ts +249 -0
- package/ts/Utils.ts +197 -0
- package/types/AgoraSdk.d.ts +40 -0
- package/types/AgoraSdk.d.ts.map +1 -0
- package/types/Decoder/gpu-utils.d.ts +21 -0
- package/types/Decoder/gpu-utils.d.ts.map +1 -0
- package/types/Decoder/index.d.ts +26 -0
- package/types/Decoder/index.d.ts.map +1 -0
- package/types/Private/AgoraBase.d.ts +5310 -0
- package/types/Private/AgoraBase.d.ts.map +1 -0
- package/types/Private/AgoraMediaBase.d.ts +1668 -0
- package/types/Private/AgoraMediaBase.d.ts.map +1 -0
- package/types/Private/AgoraMediaPlayerTypes.d.ts +453 -0
- package/types/Private/AgoraMediaPlayerTypes.d.ts.map +1 -0
- package/types/Private/IAgoraH265Transcoder.d.ts +28 -0
- package/types/Private/IAgoraH265Transcoder.d.ts.map +1 -0
- package/types/Private/IAgoraLog.d.ts +89 -0
- package/types/Private/IAgoraLog.d.ts.map +1 -0
- package/types/Private/IAgoraMediaEngine.d.ts +250 -0
- package/types/Private/IAgoraMediaEngine.d.ts.map +1 -0
- package/types/Private/IAgoraMediaPlayer.d.ts +648 -0
- package/types/Private/IAgoraMediaPlayer.d.ts.map +1 -0
- package/types/Private/IAgoraMediaPlayerSource.d.ts +109 -0
- package/types/Private/IAgoraMediaPlayerSource.d.ts.map +1 -0
- package/types/Private/IAgoraMediaRecorder.d.ts +20 -0
- package/types/Private/IAgoraMediaRecorder.d.ts.map +1 -0
- package/types/Private/IAgoraMediaStreamingSource.d.ts +42 -0
- package/types/Private/IAgoraMediaStreamingSource.d.ts.map +1 -0
- package/types/Private/IAgoraMusicContentCenter.d.ts +381 -0
- package/types/Private/IAgoraMusicContentCenter.d.ts.map +1 -0
- package/types/Private/IAgoraRhythmPlayer.d.ts +65 -0
- package/types/Private/IAgoraRhythmPlayer.d.ts.map +1 -0
- package/types/Private/IAgoraRtcEngine.d.ts +6103 -0
- package/types/Private/IAgoraRtcEngine.d.ts.map +1 -0
- package/types/Private/IAgoraRtcEngineEx.d.ts +741 -0
- package/types/Private/IAgoraRtcEngineEx.d.ts.map +1 -0
- package/types/Private/IAgoraSpatialAudio.d.ts +196 -0
- package/types/Private/IAgoraSpatialAudio.d.ts.map +1 -0
- package/types/Private/IAudioDeviceManager.d.ts +312 -0
- package/types/Private/IAudioDeviceManager.d.ts.map +1 -0
- package/types/Private/extension/AgoraBaseExtension.d.ts +14 -0
- package/types/Private/extension/AgoraBaseExtension.d.ts.map +1 -0
- package/types/Private/extension/AgoraMediaBaseExtension.d.ts +2 -0
- package/types/Private/extension/AgoraMediaBaseExtension.d.ts.map +1 -0
- package/types/Private/extension/AgoraMediaPlayerTypesExtension.d.ts +2 -0
- package/types/Private/extension/AgoraMediaPlayerTypesExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraH265TranscoderExtension.d.ts +24 -0
- package/types/Private/extension/IAgoraH265TranscoderExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraLogExtension.d.ts +2 -0
- package/types/Private/extension/IAgoraLogExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraMediaEngineExtension.d.ts +40 -0
- package/types/Private/extension/IAgoraMediaEngineExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraMediaPlayerExtension.d.ts +46 -0
- package/types/Private/extension/IAgoraMediaPlayerExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraMediaPlayerSourceExtension.d.ts +2 -0
- package/types/Private/extension/IAgoraMediaPlayerSourceExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraMediaRecorderExtension.d.ts +44 -0
- package/types/Private/extension/IAgoraMediaRecorderExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraMusicContentCenterExtension.d.ts +20 -0
- package/types/Private/extension/IAgoraMusicContentCenterExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraRhythmPlayerExtension.d.ts +2 -0
- package/types/Private/extension/IAgoraRhythmPlayerExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraRtcEngineExExtension.d.ts +2 -0
- package/types/Private/extension/IAgoraRtcEngineExExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraRtcEngineExtension.d.ts +42 -0
- package/types/Private/extension/IAgoraRtcEngineExtension.d.ts.map +1 -0
- package/types/Private/extension/IAgoraSpatialAudioExtension.d.ts +2 -0
- package/types/Private/extension/IAgoraSpatialAudioExtension.d.ts.map +1 -0
- package/types/Private/extension/IAudioDeviceManagerExtension.d.ts +2 -0
- package/types/Private/extension/IAudioDeviceManagerExtension.d.ts.map +1 -0
- package/types/Private/impl/AgoraBaseImpl.d.ts +3 -0
- package/types/Private/impl/AgoraBaseImpl.d.ts.map +1 -0
- package/types/Private/impl/AgoraMediaBaseImpl.d.ts +14 -0
- package/types/Private/impl/AgoraMediaBaseImpl.d.ts.map +1 -0
- package/types/Private/impl/IAgoraH265TranscoderImpl.d.ts +15 -0
- package/types/Private/impl/IAgoraH265TranscoderImpl.d.ts.map +1 -0
- package/types/Private/impl/IAgoraMediaEngineImpl.d.ts +46 -0
- package/types/Private/impl/IAgoraMediaEngineImpl.d.ts.map +1 -0
- package/types/Private/impl/IAgoraMediaPlayerImpl.d.ts +143 -0
- package/types/Private/impl/IAgoraMediaPlayerImpl.d.ts.map +1 -0
- package/types/Private/impl/IAgoraMediaPlayerSourceImpl.d.ts +3 -0
- package/types/Private/impl/IAgoraMediaPlayerSourceImpl.d.ts.map +1 -0
- package/types/Private/impl/IAgoraMediaRecorderImpl.d.ts +11 -0
- package/types/Private/impl/IAgoraMediaRecorderImpl.d.ts.map +1 -0
- package/types/Private/impl/IAgoraMusicContentCenterImpl.d.ts +67 -0
- package/types/Private/impl/IAgoraMusicContentCenterImpl.d.ts.map +1 -0
- package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts +116 -0
- package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts.map +1 -0
- package/types/Private/impl/IAgoraRtcEngineImpl.d.ts +628 -0
- package/types/Private/impl/IAgoraRtcEngineImpl.d.ts.map +1 -0
- package/types/Private/impl/IAgoraSpatialAudioImpl.d.ts +47 -0
- package/types/Private/impl/IAgoraSpatialAudioImpl.d.ts.map +1 -0
- package/types/Private/impl/IAudioDeviceManagerImpl.d.ts +65 -0
- package/types/Private/impl/IAudioDeviceManagerImpl.d.ts.map +1 -0
- package/types/Private/internal/AgoraH265TranscoderInternal.d.ts +14 -0
- package/types/Private/internal/AgoraH265TranscoderInternal.d.ts.map +1 -0
- package/types/Private/internal/AgoraMediaBaseInternal.d.ts +8 -0
- package/types/Private/internal/AgoraMediaBaseInternal.d.ts.map +1 -0
- package/types/Private/internal/AudioDeviceManagerInternal.d.ts +9 -0
- package/types/Private/internal/AudioDeviceManagerInternal.d.ts.map +1 -0
- package/types/Private/internal/IrisApiEngine.d.ts +69 -0
- package/types/Private/internal/IrisApiEngine.d.ts.map +1 -0
- package/types/Private/internal/LocalSpatialAudioEngineInternal.d.ts +4 -0
- package/types/Private/internal/LocalSpatialAudioEngineInternal.d.ts.map +1 -0
- package/types/Private/internal/MediaEngineInternal.d.ts +23 -0
- package/types/Private/internal/MediaEngineInternal.d.ts.map +1 -0
- package/types/Private/internal/MediaPlayerInternal.d.ts +30 -0
- package/types/Private/internal/MediaPlayerInternal.d.ts.map +1 -0
- package/types/Private/internal/MediaRecorderInternal.d.ts +16 -0
- package/types/Private/internal/MediaRecorderInternal.d.ts.map +1 -0
- package/types/Private/internal/MusicContentCenterInternal.d.ts +31 -0
- package/types/Private/internal/MusicContentCenterInternal.d.ts.map +1 -0
- package/types/Private/internal/RtcEngineExInternal.d.ts +73 -0
- package/types/Private/internal/RtcEngineExInternal.d.ts.map +1 -0
- package/types/Private/ipc/main.d.ts +2 -0
- package/types/Private/ipc/main.d.ts.map +1 -0
- package/types/Private/ipc/renderer.d.ts +3 -0
- package/types/Private/ipc/renderer.d.ts.map +1 -0
- package/types/Private/ti/AgoraBase-ti.d.ts +8 -0
- package/types/Private/ti/AgoraBase-ti.d.ts.map +1 -0
- package/types/Private/ti/AgoraMediaBase-ti.d.ts +15 -0
- package/types/Private/ti/AgoraMediaBase-ti.d.ts.map +1 -0
- package/types/Private/ti/AgoraMediaPlayerTypes-ti.d.ts +7 -0
- package/types/Private/ti/AgoraMediaPlayerTypes-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraH265Transcoder-ti.d.ts +8 -0
- package/types/Private/ti/IAgoraH265Transcoder-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraLog-ti.d.ts +7 -0
- package/types/Private/ti/IAgoraLog-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraMediaEngine-ti.d.ts +7 -0
- package/types/Private/ti/IAgoraMediaEngine-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraMediaPlayer-ti.d.ts +8 -0
- package/types/Private/ti/IAgoraMediaPlayer-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraMediaPlayerSource-ti.d.ts +8 -0
- package/types/Private/ti/IAgoraMediaPlayerSource-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraMediaRecorder-ti.d.ts +7 -0
- package/types/Private/ti/IAgoraMediaRecorder-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraMediaStreamingSource-ti.d.ts +7 -0
- package/types/Private/ti/IAgoraMediaStreamingSource-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraMusicContentCenter-ti.d.ts +8 -0
- package/types/Private/ti/IAgoraMusicContentCenter-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraRhythmPlayer-ti.d.ts +7 -0
- package/types/Private/ti/IAgoraRhythmPlayer-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraRtcEngine-ti.d.ts +10 -0
- package/types/Private/ti/IAgoraRtcEngine-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraRtcEngineEx-ti.d.ts +7 -0
- package/types/Private/ti/IAgoraRtcEngineEx-ti.d.ts.map +1 -0
- package/types/Private/ti/IAgoraSpatialAudio-ti.d.ts +7 -0
- package/types/Private/ti/IAgoraSpatialAudio-ti.d.ts.map +1 -0
- package/types/Private/ti/IAudioDeviceManager-ti.d.ts +7 -0
- package/types/Private/ti/IAudioDeviceManager-ti.d.ts.map +1 -0
- package/types/Renderer/AgoraView.d.ts +76 -0
- package/types/Renderer/AgoraView.d.ts.map +1 -0
- package/types/Renderer/CapabilityManager.d.ts +20 -0
- package/types/Renderer/CapabilityManager.d.ts.map +1 -0
- package/types/Renderer/IRenderer.d.ts +20 -0
- package/types/Renderer/IRenderer.d.ts.map +1 -0
- package/types/Renderer/IRendererCache.d.ts +26 -0
- package/types/Renderer/IRendererCache.d.ts.map +1 -0
- package/types/Renderer/RendererCache.d.ts +24 -0
- package/types/Renderer/RendererCache.d.ts.map +1 -0
- package/types/Renderer/RendererManager.d.ts +66 -0
- package/types/Renderer/RendererManager.d.ts.map +1 -0
- package/types/Renderer/WebCodecsRenderer/index.d.ts +14 -0
- package/types/Renderer/WebCodecsRenderer/index.d.ts.map +1 -0
- package/types/Renderer/WebCodecsRendererCache.d.ts +15 -0
- package/types/Renderer/WebCodecsRendererCache.d.ts.map +1 -0
- package/types/Renderer/WebGLRenderer/index.d.ts +27 -0
- package/types/Renderer/WebGLRenderer/index.d.ts.map +1 -0
- package/types/Renderer/WebGLRenderer/webgl-utils.d.ts +1 -0
- package/types/Renderer/WebGLRenderer/webgl-utils.d.ts.map +1 -0
- package/types/Renderer/YUVCanvasRenderer/index.d.ts +9 -0
- package/types/Renderer/YUVCanvasRenderer/index.d.ts.map +1 -0
- package/types/Renderer/index.d.ts +2 -0
- package/types/Renderer/index.d.ts.map +1 -0
- package/types/Types.d.ts +177 -0
- package/types/Types.d.ts.map +1 -0
- package/types/Utils.d.ts +50 -0
- package/types/Utils.d.ts.map +1 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import semver from 'semver';
|
|
2
|
+
|
|
3
|
+
import createAgoraRtcEngine from '../AgoraSdk';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
GpuInfo,
|
|
7
|
+
VideoDecodeAcceleratorSupportedProfile,
|
|
8
|
+
} from '../Decoder/gpu-utils';
|
|
9
|
+
import { VideoCodecType } from '../Private/AgoraBase';
|
|
10
|
+
import { IRtcEngineEx } from '../Private/IAgoraRtcEngineEx';
|
|
11
|
+
import { ipcSend } from '../Private/ipc/renderer';
|
|
12
|
+
|
|
13
|
+
import { IPCMessageType, VideoFallbackStrategy, codecMapping } from '../Types';
|
|
14
|
+
import { AgoraEnv, logError, logInfo } from '../Utils';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @ignore
|
|
18
|
+
*/
|
|
19
|
+
export class CapabilityManager {
|
|
20
|
+
gpuInfo: GpuInfo = new GpuInfo();
|
|
21
|
+
frameCodecMapping: {
|
|
22
|
+
[key in VideoCodecType]?: VideoDecodeAcceleratorSupportedProfile;
|
|
23
|
+
} = {};
|
|
24
|
+
webCodecsDecoderEnabled: boolean = AgoraEnv.enableWebCodecsDecoder;
|
|
25
|
+
private _engine: IRtcEngineEx;
|
|
26
|
+
|
|
27
|
+
setWebCodecsDecoderEnabled(enabled: boolean): void {
|
|
28
|
+
this.webCodecsDecoderEnabled = enabled;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
constructor() {
|
|
32
|
+
this._engine = createAgoraRtcEngine();
|
|
33
|
+
if (AgoraEnv.enableWebCodecsDecoder) {
|
|
34
|
+
this.getGpuInfo(() => {
|
|
35
|
+
if (
|
|
36
|
+
AgoraEnv.videoFallbackStrategy ===
|
|
37
|
+
VideoFallbackStrategy.PerformancePriority
|
|
38
|
+
) {
|
|
39
|
+
if (!this.isSupportedH265()) {
|
|
40
|
+
if (this.isSupportedH264()) {
|
|
41
|
+
this._engine.setParameters(
|
|
42
|
+
JSON.stringify({ 'che.video.h265_dec_enable': false })
|
|
43
|
+
);
|
|
44
|
+
logInfo(
|
|
45
|
+
'the videoFallbackStrategy is PerformancePriority, H265 is not supported, fallback to H264'
|
|
46
|
+
);
|
|
47
|
+
} else {
|
|
48
|
+
this.webCodecsDecoderEnabled = false;
|
|
49
|
+
logInfo(
|
|
50
|
+
'the videoFallbackStrategy is PerformancePriority, H264 and H265 are not supported, fallback to native decoder'
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
} else if (
|
|
55
|
+
AgoraEnv.videoFallbackStrategy ===
|
|
56
|
+
VideoFallbackStrategy.BandwidthPriority
|
|
57
|
+
) {
|
|
58
|
+
if (!this.isSupportedH265()) {
|
|
59
|
+
this.webCodecsDecoderEnabled = false;
|
|
60
|
+
logInfo(
|
|
61
|
+
'the videoFallbackStrategy is BandwidthPriority, H265 is not supported, fallback to native decoder'
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public getGpuInfo(callback?: () => void): void {
|
|
70
|
+
//getGpuInfo and videoDecoder is not supported in electron version < 22.0.0
|
|
71
|
+
//@ts-ignore
|
|
72
|
+
if (semver.lt(process.versions.electron, '22.0.0')) {
|
|
73
|
+
logError(
|
|
74
|
+
'WebCodecsDecoder is not supported in electron version < 22.0.0, please upgrade electron to 22.0.0 or later.'
|
|
75
|
+
);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
//@ts-ignore
|
|
79
|
+
if (process.type === 'renderer') {
|
|
80
|
+
ipcSend(IPCMessageType.AGORA_IPC_GET_GPU_INFO)
|
|
81
|
+
.then((result) => {
|
|
82
|
+
this.gpuInfo.videoDecodeAcceleratorSupportedProfile = result;
|
|
83
|
+
this.webCodecsDecoderEnabled = (AgoraEnv.enableWebCodecsDecoder &&
|
|
84
|
+
this.gpuInfo.videoDecodeAcceleratorSupportedProfile.length > 0)!;
|
|
85
|
+
|
|
86
|
+
result.forEach((profile: VideoDecodeAcceleratorSupportedProfile) => {
|
|
87
|
+
const match = codecMapping.find((item) =>
|
|
88
|
+
profile.codec.includes(item.profile)
|
|
89
|
+
);
|
|
90
|
+
if (match) {
|
|
91
|
+
//Normally, the range of compatible widths and heights should be the same under the same codec.
|
|
92
|
+
//there is no need to differentiate between different profiles. This could be optimized in the future.
|
|
93
|
+
this.frameCodecMapping[match.type] = {
|
|
94
|
+
codec: match.codec,
|
|
95
|
+
minWidth: profile.minWidth,
|
|
96
|
+
minHeight: profile.minHeight,
|
|
97
|
+
maxWidth: profile.maxWidth,
|
|
98
|
+
maxHeight: profile.maxHeight,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
callback && callback();
|
|
103
|
+
})
|
|
104
|
+
.catch((error) => {
|
|
105
|
+
logError(
|
|
106
|
+
'Failed to get GPU info, please check if you are already import agora-electron-sdk in the main process.',
|
|
107
|
+
error
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
logError('This function only works in renderer process');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public isSupportedH264(): boolean {
|
|
116
|
+
return this.frameCodecMapping[VideoCodecType.VideoCodecH264] !== undefined;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public isSupportedH265(): boolean {
|
|
120
|
+
return this.frameCodecMapping[VideoCodecType.VideoCodecH265] !== undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
release(): void {
|
|
124
|
+
AgoraEnv.enableWebCodecsDecoder = false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { VideoMirrorModeType } from '../Private/AgoraBase';
|
|
2
|
+
import { RenderModeType, VideoFrame } from '../Private/AgoraMediaBase';
|
|
3
|
+
import { CodecConfigInfo, RendererContext, RendererType } from '../Types';
|
|
4
|
+
|
|
5
|
+
export abstract class IRenderer {
|
|
6
|
+
parentElement?: HTMLElement;
|
|
7
|
+
container?: HTMLElement;
|
|
8
|
+
canvas?: HTMLCanvasElement;
|
|
9
|
+
rendererType: RendererType | undefined;
|
|
10
|
+
context: RendererContext = {};
|
|
11
|
+
private _frameCount = 0;
|
|
12
|
+
private _startTime: number | null = null;
|
|
13
|
+
|
|
14
|
+
public bind(element: HTMLElement) {
|
|
15
|
+
this.parentElement = element;
|
|
16
|
+
this.container = document.createElement('div');
|
|
17
|
+
Object.assign(this.container.style, {
|
|
18
|
+
width: '100%',
|
|
19
|
+
height: '100%',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
});
|
|
25
|
+
this.parentElement.appendChild(this.container);
|
|
26
|
+
this.canvas = document.createElement('canvas');
|
|
27
|
+
this.canvas.style.display = 'none';
|
|
28
|
+
this.container.appendChild(this.canvas);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public unbind() {
|
|
32
|
+
if (this.container && this.canvas?.parentNode === this.container) {
|
|
33
|
+
this.container.removeChild(this.canvas);
|
|
34
|
+
}
|
|
35
|
+
if (
|
|
36
|
+
this.parentElement &&
|
|
37
|
+
this.container?.parentNode === this.parentElement
|
|
38
|
+
) {
|
|
39
|
+
this.parentElement.removeChild(this.container);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
this.canvas = undefined;
|
|
43
|
+
this.container = undefined;
|
|
44
|
+
this.parentElement = undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public drawFrame(
|
|
48
|
+
_videoFrame?: VideoFrame,
|
|
49
|
+
_codecConfig?: CodecConfigInfo
|
|
50
|
+
): void {
|
|
51
|
+
if (!this.canvas) return;
|
|
52
|
+
if (this.canvas.style.display !== '') {
|
|
53
|
+
this.canvas.style.display = '';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public setContext(context: RendererContext) {
|
|
58
|
+
if (this.context.renderMode !== context.renderMode) {
|
|
59
|
+
this.context.renderMode = context.renderMode;
|
|
60
|
+
this.updateRenderMode();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (this.context.mirrorMode !== context.mirrorMode) {
|
|
64
|
+
this.context.mirrorMode = context.mirrorMode;
|
|
65
|
+
this.updateMirrorMode();
|
|
66
|
+
}
|
|
67
|
+
this.context = { ...this.context, ...context };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
protected updateRenderMode(): void {
|
|
71
|
+
if (!this.canvas || !this.container) return;
|
|
72
|
+
|
|
73
|
+
const { clientWidth, clientHeight } = this.container;
|
|
74
|
+
const { width, height } = this.canvas;
|
|
75
|
+
|
|
76
|
+
const containerAspectRatio = clientWidth / clientHeight;
|
|
77
|
+
const canvasAspectRatio = width / height;
|
|
78
|
+
const widthScale = clientWidth / width;
|
|
79
|
+
const heightScale = clientHeight / height;
|
|
80
|
+
const isHidden =
|
|
81
|
+
this.context.renderMode === RenderModeType.RenderModeHidden;
|
|
82
|
+
|
|
83
|
+
let scale = 1;
|
|
84
|
+
// If container's aspect ratio is larger than canvas's aspect ratio
|
|
85
|
+
if (containerAspectRatio > canvasAspectRatio) {
|
|
86
|
+
// Scale canvas to fit container's width on hidden mode
|
|
87
|
+
// Scale canvas to fit container's height on fit mode
|
|
88
|
+
scale = isHidden ? widthScale : heightScale;
|
|
89
|
+
} else {
|
|
90
|
+
// Scale canvas to fit container's height on hidden mode
|
|
91
|
+
// Scale canvas to fit container's width on fit mode
|
|
92
|
+
scale = isHidden ? heightScale : widthScale;
|
|
93
|
+
}
|
|
94
|
+
this.canvas.style.transform = `scale(${scale})`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
protected updateMirrorMode(): void {
|
|
98
|
+
if (!this.parentElement) return;
|
|
99
|
+
|
|
100
|
+
Object.assign(this.parentElement.style, {
|
|
101
|
+
transform:
|
|
102
|
+
this.context.mirrorMode === VideoMirrorModeType.VideoMirrorModeEnabled
|
|
103
|
+
? 'rotateY(180deg)'
|
|
104
|
+
: '',
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
protected rotateCanvas({ width, height, rotation }: VideoFrame): void {
|
|
109
|
+
if (!this.canvas) return;
|
|
110
|
+
|
|
111
|
+
if (rotation === 0 || rotation === 180) {
|
|
112
|
+
this.canvas.width = width!;
|
|
113
|
+
this.canvas.height = height!;
|
|
114
|
+
} else if (rotation === 90 || rotation === 270) {
|
|
115
|
+
this.canvas.height = width!;
|
|
116
|
+
this.canvas.width = height!;
|
|
117
|
+
} else {
|
|
118
|
+
throw new Error(
|
|
119
|
+
`Invalid rotation: ${rotation}, only 0, 90, 180, 270 are supported`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public getFps(): number {
|
|
125
|
+
let fps = 0;
|
|
126
|
+
if (!this.context.enableFps || !this.container) {
|
|
127
|
+
return fps;
|
|
128
|
+
}
|
|
129
|
+
if (this._startTime == null) {
|
|
130
|
+
this._startTime = performance.now();
|
|
131
|
+
} else {
|
|
132
|
+
const elapsed = (performance.now() - this._startTime) / 1000;
|
|
133
|
+
fps = ++this._frameCount / elapsed;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
let span = this.container.querySelector('span');
|
|
137
|
+
if (!span) {
|
|
138
|
+
span = document.createElement('span');
|
|
139
|
+
|
|
140
|
+
Object.assign(span.style, {
|
|
141
|
+
position: 'absolute',
|
|
142
|
+
bottom: '0',
|
|
143
|
+
left: '0',
|
|
144
|
+
zIndex: '10',
|
|
145
|
+
width: '55px',
|
|
146
|
+
background: '#fff',
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
this.container.style.position = 'relative';
|
|
150
|
+
|
|
151
|
+
this.container.appendChild(span);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
span.innerText = `fps: ${fps.toFixed(0)}`;
|
|
155
|
+
|
|
156
|
+
return fps;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { RendererCacheContext, RendererContext } from '../Types';
|
|
2
|
+
|
|
3
|
+
import { IRenderer } from './IRenderer';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
8
|
+
export function generateRendererCacheKey({
|
|
9
|
+
channelId,
|
|
10
|
+
uid,
|
|
11
|
+
sourceType,
|
|
12
|
+
}: RendererContext): string {
|
|
13
|
+
return `${channelId}_${uid}_${sourceType}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @ignore
|
|
18
|
+
*/
|
|
19
|
+
export function isUseConnection(context: RendererCacheContext): boolean {
|
|
20
|
+
// if RtcConnection is not undefined, then use connection
|
|
21
|
+
return !!context.channelId && context.localUid !== undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export abstract class IRendererCache {
|
|
25
|
+
renderers: IRenderer[];
|
|
26
|
+
cacheContext: RendererCacheContext;
|
|
27
|
+
|
|
28
|
+
constructor({
|
|
29
|
+
channelId,
|
|
30
|
+
uid,
|
|
31
|
+
useWebCodecsDecoder,
|
|
32
|
+
enableFps,
|
|
33
|
+
sourceType,
|
|
34
|
+
localUid,
|
|
35
|
+
position,
|
|
36
|
+
}: RendererContext) {
|
|
37
|
+
this.renderers = [];
|
|
38
|
+
this.cacheContext = {
|
|
39
|
+
channelId,
|
|
40
|
+
uid,
|
|
41
|
+
useWebCodecsDecoder,
|
|
42
|
+
enableFps,
|
|
43
|
+
sourceType,
|
|
44
|
+
localUid,
|
|
45
|
+
position,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public get key(): string {
|
|
50
|
+
return generateRendererCacheKey(this.cacheContext);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public abstract draw(): void;
|
|
54
|
+
|
|
55
|
+
public findRenderer(view: Element): IRenderer | undefined {
|
|
56
|
+
return this.renderers.find((renderer) => renderer.parentElement === view);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public addRenderer(renderer: IRenderer): void {
|
|
60
|
+
this.renderers.push(renderer);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Remove the specified renderer if it is specified, otherwise remove all renderers
|
|
65
|
+
*/
|
|
66
|
+
public removeRenderer(renderer?: IRenderer): void {
|
|
67
|
+
let start = 0;
|
|
68
|
+
let deleteCount = this.renderers.length;
|
|
69
|
+
if (renderer) {
|
|
70
|
+
start = this.renderers.indexOf(renderer);
|
|
71
|
+
if (start < 0) return;
|
|
72
|
+
deleteCount = 1;
|
|
73
|
+
}
|
|
74
|
+
this.renderers.splice(start, deleteCount).forEach((it) => it.unbind());
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public setRendererContext(context: RendererContext): boolean {
|
|
78
|
+
if (context.view) {
|
|
79
|
+
const renderer = this.findRenderer(context.view);
|
|
80
|
+
if (renderer) {
|
|
81
|
+
renderer.setContext(context);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
} else {
|
|
86
|
+
this.renderers.forEach((it) => {
|
|
87
|
+
it.setContext(context);
|
|
88
|
+
});
|
|
89
|
+
return this.renderers.length > 0;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public release(): void {
|
|
94
|
+
this.removeRenderer();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { VideoFrame } from '../Private/AgoraMediaBase';
|
|
2
|
+
import { AgoraElectronBridge } from '../Private/internal/IrisApiEngine';
|
|
3
|
+
|
|
4
|
+
import { RendererContext } from '../Types';
|
|
5
|
+
import { AgoraEnv, logDebug } from '../Utils';
|
|
6
|
+
|
|
7
|
+
import { IRenderer } from './IRenderer';
|
|
8
|
+
import { IRendererCache } from './IRendererCache';
|
|
9
|
+
|
|
10
|
+
export class RendererCache extends IRendererCache {
|
|
11
|
+
private videoFrame: VideoFrame;
|
|
12
|
+
private _enabled: boolean;
|
|
13
|
+
|
|
14
|
+
constructor(context: RendererContext) {
|
|
15
|
+
super(context);
|
|
16
|
+
this.videoFrame = {
|
|
17
|
+
yBuffer: Buffer.alloc(0),
|
|
18
|
+
uBuffer: Buffer.alloc(0),
|
|
19
|
+
vBuffer: Buffer.alloc(0),
|
|
20
|
+
alphaBuffer: AgoraEnv.encodeAlpha ? Buffer.alloc(0) : undefined,
|
|
21
|
+
width: 0,
|
|
22
|
+
height: 0,
|
|
23
|
+
yStride: 0,
|
|
24
|
+
uStride: 0,
|
|
25
|
+
vStride: 0,
|
|
26
|
+
rotation: 0,
|
|
27
|
+
};
|
|
28
|
+
this._enabled = false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use videoFrame instead
|
|
33
|
+
*/
|
|
34
|
+
public get shareVideoFrame(): VideoFrame | undefined {
|
|
35
|
+
return this.videoFrame;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private enable() {
|
|
39
|
+
if (this._enabled) return;
|
|
40
|
+
AgoraElectronBridge.EnableVideoFrameCache(this.cacheContext);
|
|
41
|
+
this._enabled = true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private disable() {
|
|
45
|
+
if (!this._enabled) return;
|
|
46
|
+
AgoraElectronBridge.DisableVideoFrameCache(this.cacheContext);
|
|
47
|
+
this._enabled = false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private shouldEnable() {
|
|
51
|
+
if (this.renderers.length > 0) {
|
|
52
|
+
this.enable();
|
|
53
|
+
} else {
|
|
54
|
+
this.disable();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
override draw() {
|
|
59
|
+
let { ret, isNewFrame } = AgoraElectronBridge.GetVideoFrame(
|
|
60
|
+
this.cacheContext,
|
|
61
|
+
this.videoFrame,
|
|
62
|
+
{
|
|
63
|
+
encodeAlpha: AgoraEnv.encodeAlpha,
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
switch (ret) {
|
|
68
|
+
case 0: // GET_VIDEO_FRAME_CACHE_RETURN_TYPE::OK = 0
|
|
69
|
+
//
|
|
70
|
+
break;
|
|
71
|
+
case 1: // GET_VIDEO_FRAME_CACHE_RETURN_TYPE::RESIZED = 1
|
|
72
|
+
const { yStride, uStride, vStride, height } = this.videoFrame;
|
|
73
|
+
this.videoFrame.yBuffer = Buffer.alloc(yStride! * height!);
|
|
74
|
+
this.videoFrame.uBuffer = Buffer.alloc(uStride! * height!);
|
|
75
|
+
this.videoFrame.vBuffer = Buffer.alloc(vStride! * height!);
|
|
76
|
+
if (AgoraEnv.encodeAlpha) {
|
|
77
|
+
this.videoFrame.alphaBuffer = Buffer.alloc(
|
|
78
|
+
this.videoFrame.width! * this.videoFrame.height!
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const result = AgoraElectronBridge.GetVideoFrame(
|
|
83
|
+
this.cacheContext,
|
|
84
|
+
this.videoFrame,
|
|
85
|
+
{
|
|
86
|
+
encodeAlpha: AgoraEnv.encodeAlpha,
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
ret = result.ret;
|
|
90
|
+
isNewFrame = result.isNewFrame;
|
|
91
|
+
break;
|
|
92
|
+
case 2: // GET_VIDEO_FRAME_CACHE_RETURN_TYPE::NO_CACHE = 2
|
|
93
|
+
logDebug('No renderer cache, please enable cache first');
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (!AgoraEnv.encodeAlpha) {
|
|
98
|
+
this.videoFrame.alphaBuffer = undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (isNewFrame) {
|
|
102
|
+
this.renderers.forEach((renderer) => {
|
|
103
|
+
renderer.drawFrame(this.videoFrame);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
override addRenderer(renderer: IRenderer): void {
|
|
109
|
+
super.addRenderer(renderer);
|
|
110
|
+
this.shouldEnable();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Remove the specified renderer if it is specified, otherwise remove all renderers
|
|
115
|
+
*/
|
|
116
|
+
override removeRenderer(renderer?: IRenderer): void {
|
|
117
|
+
super.removeRenderer(renderer);
|
|
118
|
+
this.shouldEnable();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public release(): void {
|
|
122
|
+
super.release();
|
|
123
|
+
}
|
|
124
|
+
}
|