This demo exposes a video conference sample with the possibility to select streams you want to publish or subscribe. You are also able to choose the type of stream you want to use , audio only, video only or audio & video.

Connect to the conference

Check our tutorial on conversation to have details about the conversation bases.

Publish your stream

When you publish your stream, use the publishOptions parameters to select media type you want to publish. Set mediaRestriction to audioOnly or videoOnly depending of your needs.

        let publishOptions = PublishOptions(mediaRestriction: .audioOnly)
        conversation.publish(stream: stream, options: publishOptions) { (error, stream) in
            if let error = error {

Use unpublishStreamWithId to stop publishing your stream.

        conversation.unpublishStreamWithId(streamId, completion: {})

Subscribe to available streams

When you subscribe to streams, use the subscribeOptions parameters to select media type you want to subscribe. Set audioOnly / videoOnly boolean to true or false depending of your needs.

       let subscribeOptions = SubscribeOptions(mediaRestriction: .audioOnly)
        conversation.subscribeToStream(streamId: streamId, options: subscribeOptions)

Use unsubscribeFromStreamWithId to stop subscribing a stream.