aws-samples / amazon-ivs-broadcast-ios-sample

MIT No Attribution
18 stars 11 forks source link

Camera and Mic Issue. #40

Closed rishopbabu closed 1 year ago

rishopbabu commented 1 year ago

Hi team, I'm facing an issue like, after I leave the stage and even deleted the stage, camera and mic is still running in the background. Does it work like this or this has any solution. Thanks in Advance.

rishopbabu commented 1 year ago

self.broadcastSession?.stop() self.broadcastSession = nil self.deleteStage(stageArn: self.stageArnValue) #(API calling)

this is what I do when leave the delete the stage.

bclymer commented 1 year ago

Hi @rishopbabu , the camera and microphone are devices that exist outside of a Stage and Broadcast, but can be attached to them. This means when you leave the stage and stop the broadcast, the device still exists and is running.

You need to set all your local references to the device to nil, including any IVSLocalStageStream references. The devices might also still be attached to the Stage and BroadcastSession even if you've cleared your own references. You could fix this by setting those to nil as well (I see you already do that for BroadcastSession), or by detaching the devices.

You can use the Xcode memory debugger to look for these objects to see what is holding a reference to them as well. IVSCameraSource and IVSMicrophoneSource are the class names for the camera and microphone devices.

rishopbabu commented 1 year ago

Thanks for the support @bclymer. The suggestion you gave worked actually.