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.

Track not stopping

See original GitHub issue

Since 1.2.0 upgrade, it looks like stream tracks are not stopping, and the chrome red light is left on even after component unmount. Does anyone have the same issue ?

I tried to stop the stream tracks through a “VideoPreview” function component with no success !

const VideoPreview = ({ stream, status}) => {
  const videoRef = useRef()

  useEffect(() => {
    if (videoRef.current && stream) {
      videoRef.current.srcObject = stream;
    }
    return () => {
      if (status == 'stopped') {
        stream.getTracks().forEach(track => track.stop())
        stream.getTracks().forEach(track => (track.enabled = false))
      }
    }
  }, [stream]);

  if (!stream)
    return null;

  return <video ref={videoRef} id="localVideo" className="video-preview" autoPlay muted/>;
};

Seems like there’s a missing opened stream left unstopped somewhere… Would that be a bug on our side ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
andreybs11commented, Jul 8, 2020

It is not fixed ❗

Use case: if the user “closes” the recorder before starting to record, then there is no way to stop audio tracks because mediaRecorder.current = null and previewVideo only contains video tracks (https://github.com/0x006F/react-media-recorder/blob/master/src/index.ts#L240).

Maybe consider providing a stopAudio render prop OR adding getters for mediaRecorder and mediaStream.

Thanks

1reaction
0x006Fcommented, Jun 29, 2020

Hey @dfabreguette-ap a small patch have been landed via #17 . Can you please update it to the latest and check?

Let me know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

track.stop is not turning the camera off anymore - Stack Overflow
In your stopStreaming function you only stop the first track in the returned array. If you instead iterate through the tracks you may...
Read more >
track.stop() does not stop stream transmission #140 - GitHub
During a call/video call stopping the video stream does nothing and the remote peer follows to hear me.Stream transmission is not stopped.
Read more >
MediaStreamTrack.stop() - Web APIs - MDN Web Docs - Mozilla
Calling stop() tells the user agent that the track's source—whatever that source may be, including files, network streams, or a local camera ...
Read more >
Animation not stopping when using a Track:Stop()
Hello, i have an issue where my animation wont stop when using Track:Stop(), its a looped animation running in a basic stat training...
Read more >
Do Not Stop on Tracks Sign R8-8 | Road Signs - Traffic Signs
R8-8 Do Not Stop On Tracks Sign. Reflective Sheeting on Aluminum. Radius Corners. 3/8" Prepunched Holes. High Intensity and Diamond Grade Meet DOT...
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