Kotlin

Enable Sender Stats on the Publisher

Connect to the session, publish your camera, and enable Sender-Side Statistics so subscribers can access publisher-side metrics

1. Start by Connecting to a Session and Publishing

Build a Session, set a SessionListener, and connect with your token. When onConnected fires, create and publish a Publisher:

private fun connectToSession() {
    if (session != null) return
    session = Session.Builder(
        this,
        VonageVideoConfig.APP_ID,
        VonageVideoConfig.SESSION_ID,
    ).build()
    session?.setSessionListener(sessionListener)
    session?.connect(VonageVideoConfig.TOKEN)
}

2. Enable Sender-Side Statistics

To receive Sender-Side Statistics enable them on the stream’s publisher by setting senderStatsTrack(true) when building the publisher:

override fun onConnected(session: Session) {
    publisher = Publisher.Builder(this@MainActivity)
        .senderStatsTrack(true)   // Enable sender-side statistics for this publisher
        .build()
    publisher?.setPublisherListener(publisherListener)
    session.publish(publisher)
}

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.