AgoraIO / AgoraRtcEngine_iOS

iOS Package for Agora Video RTE SDK. Perfect for video calls and live streaming.
https://agoraio.github.io/AgoraRtcEngine_iOS/
MIT License
58 stars 17 forks source link

[v4.1.1] Camera remains on after switching role to audience in multi-channel setup #37

Closed akshaan closed 1 year ago

akshaan commented 1 year ago

I'm attempting to join multiple channels on a shared AgoraRtcEngineKit instance. After joining the channel with role audience and then switching the client role to broadcaster and then back to audience, the camera seems to remain on as indicated by the green dot on the iphone. I was wondering if there is a different way to release the camera in the multi-channel setup, or if this could be a bug in the SDK

Code for joining channel:

let option = AgoraRtcChannelMediaOptions()
option.channelProfile = .liveBroadcasting
option.clientRoleType = .audience
option.autoSubscribeVideo = true
option.autoSubscribeAudio = true
option.publishCameraTrack = true
option.publishMicrophoneTrack = true
option.publishSecondaryCameraTrack = true
let token = token
let channel = channel
var result = agoraKit.joinChannelEx(
            byToken: token,
            connection: AgoraRtcConnection(channelId: channel, localUid: id),
            delegate: delegate,
            mediaOptions: option
       )

Code for switching roles:

let newOptions = AgoraRtcChannelMediaOptions()
newOptions.channelProfile = .liveBroadcasting
newOptions.clientRoleType = role
newOptions.autoSubscribeVideo = true
newOptions.autoSubscribeAudio = true
newOptions.publishCameraTrack = true
newOptions.publishMicrophoneTrack = true
newOptions.publishSecondaryCameraTrack = true
agoraKit.updateChannelEx(with: newOptions, connection: AgoraRtcConnection(channelId: channel, localUid: id))

I also tried using muteLocalVideoStreamEx but that didn't work