Skip to content

Commit

Permalink
fix: some AudioFrameObserver & VideoFrameObserver issue
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Sep 27, 2022
1 parent a9f679b commit 58063be
Show file tree
Hide file tree
Showing 42 changed files with 127 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ export default class AudioMixing
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Only need to enable audio on this case
this.engine.enableAudio();
Expand Down Expand Up @@ -168,6 +168,7 @@ export default class AudioMixing
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ export default class AudioSpectrum
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Only need to enable audio on this case
this.engine.enableAudio();
Expand Down Expand Up @@ -141,6 +141,7 @@ export default class AudioSpectrum
*/
protected releaseRtcEngine() {
this.unregisterAudioSpectrumObserver();
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ export default class BeautyEffect
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

this.engine?.enableExtension(
'agora_video_filters_clear_vision',
Expand Down Expand Up @@ -152,6 +152,7 @@ export default class BeautyEffect
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ export default class ChannelMediaRelay
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down Expand Up @@ -184,6 +184,7 @@ export default class ChannelMediaRelay
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ export default class ContentInspect
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down Expand Up @@ -141,6 +141,7 @@ export default class ContentInspect
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ export default class DeviceManager
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ export default class DirectCdnStreaming
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down Expand Up @@ -186,6 +186,7 @@ export default class DirectCdnStreaming
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ export default class EncodedVideoFrame
}

this.engine = createAgoraRtcEngine() as IRtcEngineEx;
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ export default class Encryption
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down Expand Up @@ -137,6 +137,7 @@ export default class Encryption
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ export default class Extension
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down Expand Up @@ -134,6 +134,7 @@ export default class Extension
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ export default class JoinMultipleChannel
}

this.engine = createAgoraRtcEngine() as IRtcEngineEx;
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down Expand Up @@ -219,6 +219,7 @@ export default class JoinMultipleChannel
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ export default class LocalSpatialAudioEngine
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
// ⚠️ Must use AudioScenarioGameStreaming on this case
audioScenario: AudioScenarioType.AudioScenarioGameStreaming,
});
this.engine.registerEventHandler(this);

// Only need to enable audio on this case
this.engine.enableAudio();
Expand Down Expand Up @@ -164,6 +164,7 @@ export default class LocalSpatialAudioEngine
*/
protected releaseRtcEngine() {
this.releaseLocalSpatialAudioEngine();
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ export default class MediaPlayer
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
});
this.engine.registerEventHandler(this);

this.createMediaPlayer();
}
Expand Down Expand Up @@ -210,7 +210,7 @@ export default class MediaPlayer
*/
protected releaseRtcEngine() {
this.destroyMediaPlayer();

this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ export default class MediaRecorder
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ export default class PlayEffect
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Only need to enable audio on this case
this.engine.enableAudio();
Expand Down Expand Up @@ -181,6 +181,7 @@ export default class PlayEffect
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ export default class PushVideoFrame
}

this.engine = createAgoraRtcEngine() as IRtcEngineEx;
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ export default class RTMPStreaming
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down Expand Up @@ -275,6 +275,7 @@ export default class RTMPStreaming
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ export default class RhythmPlayer
}

this.engine = createAgoraRtcEngine();
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Only need to enable audio on this case
this.engine.enableAudio();
Expand Down Expand Up @@ -152,6 +152,7 @@ export default class RhythmPlayer
* Step 5: releaseRtcEngine
*/
protected releaseRtcEngine() {
this.engine?.unregisterEventHandler(this);
this.engine?.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ export default class ScreenShare
}

this.engine = createAgoraRtcEngine() as IRtcEngineEx;
this.engine.registerEventHandler(this);
this.engine.initialize({
appId,
// Should use ChannelProfileLiveBroadcasting on most of cases
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
this.engine.registerEventHandler(this);

// Need to enable video on this case
// If you only call `enableAudio`, only relay the audio stream to the target channel
Expand Down
Loading

0 comments on commit 58063be

Please sign in to comment.