How to stop tokbox screen sharing in SWIFT

前端 未结 1 1180
天命终不由人
天命终不由人 2021-01-28 13:53

I am working on an IOS application(SWIFT) in which i have used tokbox for screensharing, i am able to share the screen but not able to stop screensharing.

This is the cod

相关标签:
1条回答
  • 2021-01-28 14:18

    To stop screen sharing will need to stop the publisher from streaming. To do that you can call:

    [OTSession unpublish:error:]

    More info is available on the Video API guides

    For your case, where you are adding screen sharing to an existing call, you will need to create an additional publisher for the screen sharing rather than editing the existing one. To use the existing publisher it will require the publisher to be reinitialised to switch between publishing a camera feed vs a screen which will stop publishing audio too.

    In addition to creating a new publisher, you need to create a new subscriber for the other user, you can do that in the subscriberDidConnect delegate function on the OTSubscriberDelegate.

    Additionally, you will need to handle the destruction of both the new publisher and subscriber. This will be done in the delegate functions are you using already on the OTSessionDelegate and OTPublisherDelegate.

    I have created a demo app which demonstrates this behaviour.

    0 讨论(0)
提交回复
热议问题