opentok / opentok-ios-sdk-samples-swift

Sample applications using the OpenTok iOS SDK in Swift
https://tokbox.com/
MIT License
137 stars 65 forks source link

Warning: -[AVCaptureSession startRunning] should be called from background thread #182

Closed ClaireRimel closed 1 year ago

ClaireRimel commented 1 year ago

Xcode 14.0 OpenTok via CocoaPods, pod version 2.23.1

I implemented the publisher as showed on the Basic-Video-Chat project but on the instantiation of the Publisher, It's appears a warning -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness.

I have tried to set it on background thread, but it doesn't work, because it needs to be set on main thread.

How this warning can be fixed?

Screenshot 2022-10-27 at 16 41 45

knightcode commented 1 year ago

Also having this issue. Calling the constructor in a background thread also complains because the View's initWithFrame: needs to be called on the main thread. So damned either way.

Moreover, if we want an audio only experience, we don't need you creating view at all. So can you defer the UI creation until we ask for it?

v-kpheng commented 1 year ago

@ClaireRimel, thanks for letting us know about this issue. This was fixed in 2.24.0, which was released recently. See release notes here: https://tokbox.com/developer/sdks/ios/release-notes.html.

image

Since this was fixed, I'm going to close this issue. If you're still able to reproduce, please let us know. Thanks!

ClaireRimel commented 1 year ago

Thank you @v-kpheng for your answer.

With this 2.4.0 version I observe a latency of 10sec between the call of doPublish() and the call of session.publish(publisher, error: &error) which make the view freezing during the 10sec. 2 4 0Version

On 2.3.1 version this latency was around 1-2 seconds 2 23 1Version

Here the Sample of my code code_sample

How is it possible to reduce this latency?

v-kpheng commented 1 year ago

Thank you @v-kpheng for your answer.

With this 2.4.0 version I observe a latency of 10sec between the call of doPublish() and the call of session.publish(publisher, error: &error) which make the view freezing during the 10sec. 2 4 0Version

On 2.3.1 version this latency was around 1-2 seconds 2 23 1Version

Here the Sample of my code code_sample

How is it possible to reduce this latency?

@ClaireRimel, can you please file another issue? Reason being, it seems unrelated to the issue we just closed. Thanks!