question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MediaStreamTrack has been disposed

See original GitHub issue

Hey guys. When I end the call the following error

I am using firebase to save the information.

image

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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
saghulcommented, Sep 25, 2021

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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found