MediaStreamTrack has been disposed
See original GitHub issueHey guys. When I end the call the following error
I am using firebase to save the information.
My code hangup
const hangup = async () => {
setGettingCall(false)
connecting.current = false
streamCleanUp()
firestoreCleanUp()
if (pc.current) {
pc.current.close()
}
}
My code streamCleanUp
const streamCleanUp = async () => {
if (localStream) {
localStream.getTracks().forEach((t) => t.stop())
localStream.release()
}
setLocalStream(null)
setRemoteStream(null)
}
My code firestoreCleanUp
const firestoreCleanUp = async () => {
const cRef = firestore().collection("meet").doc("chatId")
if (cRef) {
const calleeCandidate = await cRef.collection("callee").get()
calleeCandidate.forEach(async (candidate) => {
await candidate.ref.delete()
})
const callerCandidate = await cRef.collection("caller").get()
callerCandidate.forEach(async (candidate) => {
await candidate.ref.delete()
})
cRef.delete()
}
}
Expected behavior
No warning after ending call
- React Native version: 0.65.1
- Plugin version: 0.0.0.0
- OS: Android
- OS version: 10
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
5128 - Android: dispose MediaStream fails - webrtc - Monorail
This error means that when the video source is disposed, something still has a reference to it. Probably the video track. In step...
Read more >App crashes when disposing Mediastream on Android.
IllegalStateException: MediaStreamTrack has been disposed. at org.webrtc.MediaStreamTrack.checkMediaStreamTrackExists(MediaStreamTrack.java:120).
Read more >Is there a correct way to dispose/release the MediaStream ...
If the user wants to scroll to a stream that has been disposed of, my app crashes with the exception MediaStreamTrack has been...
Read more >sdk/android/api/org/webrtc/MediaStream.java - Google Git
throw new IllegalStateException("MediaStream has been disposed."); } } private static void removeMediaStreamTrack(. List<? extends MediaStreamTrack> tracks, ...
Read more >MediaStreamTrack.stop() - Web APIs - MDN Web Docs - Mozilla
... or a local camera or microphone—is no longer needed by the MediaStreamTrack . Since multiple tracks may use the same source (for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll double check, maybe I messed up in https://github.com/react-native-webrtc/react-native-webrtc/commit/cec18d23448fc3a96605838d11b8030074643e06
The code should be resilient to the way you are doing things…
https://github.com/react-native-webrtc/react-native-webrtc/pull/1078