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.

Android: Media device stream not released

See original GitHub issue

Trying to dispose of the local media stream doesn’t seem to work correctly. I am calling:

localStream.getTracks().forEach(t => t.stop());
localStream.release();

But signs are pointing to it still being used.

  • I can see camera related logging (org.webrtc.Logging: CameraStatistics: Camera fps: 30) continuing on my main device (Nexus 5X, Android 7.1.1) and similar behaviour on another device (Samsung Tablet, Android 5.1.1).
  • Device continues to feel hot.
  • Battery stats show the usage for the app continues to use the camera.

I think https://github.com/oney/react-native-webrtc/issues/101 might be related to this.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
stwinamecommented, Nov 13, 2016

@maximovicd I have managed to reproduce your solution.

stopCapture only exists on VideoCapturerAndroid so the VideoCapturer instance needs to be cast back.

@zxcpoiu This is the VideoCapturer reference that needs to be kept and have stopCapture called on. https://github.com/oney/react-native-webrtc/blob/master/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java#L323

It also seems to fix https://github.com/oney/react-native-webrtc/issues/101 for me.

I will try and find the time to get a PR together. I need to get a better understanding of WebRTCModule.java and when stopCapture should be called first.

0reactions
lyubomircommented, Nov 14, 2016

I’ll have the time to look into this issue next week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Media Player Streaming not working - Stack Overflow
I have created one streaming audio application which is working on some Android devices but except moto g (6.0. 1)API. Code: URL url...
Read more >
Fix problems with videos in your library - Google TV Help
Fix problems with videos in your library · Clear the app's cache · Check for app updates · Restart your phone or tablet...
Read more >
MediaPlayer - Android Developers
MediaPlayer class can be used to control playback of audio/video files and streams. MediaPlayer is not thread-safe. Creation of and all access to...
Read more >
MediaDevices.getUserMedia() - Web APIs | MDN
It returns a Promise that resolves to a MediaStream object. If the user denies permission, or matching media is not available, then the...
Read more >
NVIDIA SHIELD Android TV Pro Streaming Media Player; 4K ...
Amazon.com: NVIDIA SHIELD Android TV Pro Streaming Media Player; 4K HDR movies, ... Available at a lower price from other sellers that may...
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