twilio / video-quickstart-ios

Twilio Video Quickstart for iOS
https://www.twilio.com/docs/api/video
MIT License
460 stars 177 forks source link

Network Quality API not firing anymore #541

Closed Shagans982 closed 3 years ago

Shagans982 commented 4 years ago

We've been using the network quality API in our app with success. When throttled via the iPad network conditioner, we were able to reliably get it to show and dismiss repeatedly. Now for some reason using the same practices are not able to get it to show at all.

I've double checked the code and nothing has changed. The configuration is set as the following:

func connectVideoCall(accessToken: String, roomConnectionHandler: @escaping (Result<Void, Error>) -> Void) {

        self.localParticipantConnectionHandler = roomConnectionHandler

        prepareLocalMedia()

        let connectOptions = TVIConnectOptions(token: accessToken) { [weak self] builder in

            guard
                let localParticipantAudioTrack = self?.localParticipantAudioTrack,
                let localParticipantVideoTrack = self?.localParticipantVideoTrack
            else {
                builder.audioTracks = []
                builder.videoTracks = []
                return
            }

            builder.audioTracks = [localParticipantAudioTrack]
            builder.videoTracks = [localParticipantVideoTrack]
            builder.isNetworkQualityEnabled = true // configured here
        }

        room = TwilioVideo.connect(with: connectOptions, delegate: self)
    }

and using the delegate:

extension TwilioVideoServiceCoordinator: TVILocalParticipantDelegate {

    func localParticipant(_ participant: TVILocalParticipant, didChange networkQualityLevel: TVINetworkQualityLevel) {

        statusCoordinatorDelegate?.isNetworkConnectionPoor = (networkQualityLevel == .one || networkQualityLevel == .zero)
    }
}

Any suggestions as to why this would have all of a sudden changed? We've tested it numerous ways over the last few days with no luck.

ceaglest commented 4 years ago

Hey @Shagans982,

Any suggestions as to why this would have all of a sudden changed? We've tested it numerous ways over the last few days with no luck.

Nothing in particular comes to mind, unless for some reason you are no longer connecting to a Group or Small Group Room. Two questions:

  1. Could you share a Room SID where the problem occurred (and if possible, which Participant didn't see network quality events)?
  2. Are you receiving any invocations of func localParticipant(_ participant: TVILocalParticipant, didChange networkQualityLevel: TVINetworkQualityLevel) with a level greater than 1?

Best, Chris

Shagans982 commented 4 years ago

Ahhhh, that might be it. I believe we're now on P2P. We're not getting any notifications at all.

ceaglest commented 4 years ago

Got it. The network quality metrics are computed by the media server, so the feature is only available in Group Rooms.

ceaglest commented 3 years ago

Please let us know if you need any more help with network quality APIs.

Best, Chris