Search code examples
iosopentoktokbox

How can I render a TokBox Screen Share stream in aspectFit


I have a TokBox iOS app that renders a Screen Share stream for the user. The video stream is cropped if it is larger than the view. It is set by default to an aspect FILL.

I cannot find a way to change this to aspect FIT. Does anyone know if this is possible on TokBox iOS?


Solution

  • For my case, this will do the trick, self.subscriber is an instance of OTSubscriber:

    self.subscriber.viewScaleBehavior = OTVideoViewScaleBehaviorFit;;
    

    You can also check this out: https://tokbox.com/developer/sdks/ios/reference/Constants/OTVideoViewScaleBehavior.html