Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually stop the track when the broadcast extension socket is closed (…
…#520) This closes #446 Two fixes: ~1. It seems that stopping the broadcast via tapping on the system indicator and choosing "stop broadcast" calls the `broadcastPaused` method instead of the `broadcastFinished` method on the SampleHandler. The only way I could trigger `broadcastFinished` in testing was by locking my device. I could not find a way to trigger `broadcastResumed` so I just went ahead and treated "pause" as final, and close the socket (I think maybe this is vestigial from older iterations of ReplayKit? not sure, it's not an area I'm super familiar with)~ 2. When the socket closes the frame reader stops but never notified the BroadcastScreenCapturer that owns it, so the track would stay published even as it stopped being updated. This fix adds a new callback method to pass the closure up the stack and stop the track. Not sure what happened in original testing but actually broadcastFinished _is_ called as expected, and broadcastPaused is called when you open the "stop capture" dialog, not when you finish it. I also fixed it to properly unpublish the track, not sure why initial testing showed simply ending capture to be enough. --------- Co-authored-by: hiroshihorie <[email protected]>
- Loading branch information