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

The camera for the first user is not appearing, only after another user joins #53

Closed ArthurHenriqueVieira closed 10 months ago

ArthurHenriqueVieira commented 11 months ago

Hello!

I've been having this problem where when I start a channel, my camera icon is not appearing, only when another user joins in the channel, for some reason my user camera appears:

my code:

ScrollView(.vertical, showsIndicators: false) {
                VStack(spacing: .zero) {
                    ForEach(Array(users), id: \.self) { uid in
                        AgoraVideoCanvasView(manager: dependencies.watchPartyScene.getManager(), uid: uid)
                            .aspectRatio(contentMode: .fit)
                            .cornerRadius(2.ds.quants)
                            .clipShape(Circle())
                            .allowsHitTesting(false)
                    }
                }
                .padding(4.ds.quants)
            }

and I add users and remove them using the delegates:

public override func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinedOfUid uid: UInt, elapsed: Int) {
        var users = allUsers
        users.insert(uid)
        userUpdate.send(users)
    }

    public override func rtcEngine(_ engine: AgoraRtcEngineKit, didOfflineOfUid uid: UInt, reason: AgoraUserOfflineReason) {
        userUpdate.send(allUsers)
    }
maxxfrazer commented 11 months ago

try making sure that the local user is added to the set on the main thread, sounds like that kind of issue.

ArthurHenriqueVieira commented 11 months ago

I've made sure it's running on the main thread, no use.

Also, if I add this code:

public override func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinChannel channel: String, withUid uid: UInt, elapsed: Int) {
            var users = allUsers
            users.insert(uid)
            userUpdate.send(users)
        }

Not only it doesn't appear when joining the channel created, when another user joins he doesn't appear also.

ArthurHenriqueVieira commented 11 months ago

the bizarre thing is, even if I hardcode the uid, it doesn't appear:

ScrollView(.vertical, showsIndicators: false) {
                VStack(spacing: .zero) {
                    ForEach(Array([UInt(9)]), id: \.self) { uid in
                        AgoraVideoCanvasView(manager: dependencies.watchPartyScene.getManager(), uid: uid)
                            .aspectRatio(contentMode: .fit)
                            .cornerRadius(2.ds.quants)
                            .clipShape(Circle())
                            .allowsHitTesting(false)
                    }
                }
                .padding(4.ds.quants)
            }
maxxfrazer commented 11 months ago

There's a bit too much unknown here, here's some debugging pointers though

If you're still having trouble, dial the implementation back to the examples in SwiftUIRtc, then add pieces from your code back in.

Here's further docs on SwiftUIRtc: https://agoraio-community.github.io/SwiftUIRtc/documentation/swiftuirtc/

maxxfrazer commented 11 months ago

Also try using the debug view hierarchy tool in Xcode.

We have many comprehensive examples using SwiftUI here: https://github.com/AgoraIO/video-sdk-samples-ios

maxxfrazer commented 10 months ago

going to close this due to inactivity