engine.release(); 异常
example 中 hook/JoinChannelVideo/JoinChannelVideo.tsx 使用报错
@LichKing-2234 I can reproduce the same error with:
try {
console.log('release type: ', typeof engine.current.release);
engine.current.release();
} catch (e) {
console.log('release error: ', e);
}
log:
LOG release type: function
LOG release error: [TypeError: undefined is not a function]
@EkaanshArora What is engine.current?
@LichKing-2234 it's likey a useRef usage
It's just a ref that holds the IRtcEngine object returned by createAgoraRtcEngine:
let engine = useRef();
engine.current = createAgoraRtcEngine();
@EkaanshArora but in demo file use "useState" const [engine] = useState(createAgoraRtcEngine());
For immutable values in React it's recommended to use a ref. Nevertheless, the error with the release method is consistent across both usages.
@EkaanshArora
I already use "useRef", but not work.

@LichKing-2234 I updated our v3.x quickstart example to v4.0.0 it reproduces this issue. You can test it here.
LOG JoinChannelSuccess {"channelId": "test", "localUid": 4131065458}
LOG UserJoined {"channelId": "test", "localUid": 4131065458} 2620116037
LOG release error: [TypeError: undefined is not a function]
Will be fixed in the 4.1.0 version.
Will be fixed in the 4.1.0 version.
I have same issues. How to most succinctly unregister all listenners when engine.release() throw above error? @LichKing-2234
@vietdung123 you can call removeAllListeners before release