Swift

Enable Sender Stats on the Publisher

Connect to the session, publish your camera, and enable sender-side statistics on your OTPublisher.

Set it on the publisher of each stream you care about—otherwise subscriber remotePublisherTransport may stay limited.

1. Connect to the Session

Implement setup() to create an OTSession and connect:

private var session: OTSession?

func setup() {
    session = OTSession(applicationId: kAppId, sessionId: kSessionId, delegate: self)
    var error: OTError?
    session?.connect(withToken: kToken, error: &error)
    if let error {
        print("Session connect error: \(error)")
    }
}

Adopt OTSessionDelegate on VonageVideoManager (in an extension) to handle connection and streams.

2. Enable Sender-Side Statistics

To receive sender-side statistics, enable them on the stream’s publisher by setting senderStatsTrack on OTPublisherKitSettings:

func sessionDidConnect(_ session: OTSession) {
    let settings = OTPublisherSettings()
    settings.name = UIDevice.current.name
    settings.senderStatsTrack = true   // Enable sender-side statistics for this publisher

    let publisher = OTPublisher(delegate: self, settings: settings)
    self.publisher = publisher

    var error: OTError?
    session.publish(publisher, error: &error)
    if let error {
        print("Publish error: \(error)")
    }

    if let view = publisher.view {
        DispatchQueue.main.async {
            self.pubView = view
        }
    }
}

Subscriber media link fields such as transport and especially remotePublisherTransport may be limited unless sender-side statistics (and/or audio fallback) are enabled on the publisher.

See Subscriber Media Link Statistics in the overview guide.