Search code examples
iosstreamframewebrtcopentok

Are OpenTok stream video dimensions reversed?


I'm developing an app using OpenTok for iPad/iPhone. When a device is in portrait, user.stream.videoDimensions.width gives 640 and user.stream.videoDimensions.height gives 480, while it should be 480 and 640 respectively.

When a device is in landscape, user.stream.videoDimensions.width gives 480 and user.stream.videoDimensions.height gives 640, while it should be 640 and 480 respectively.

I have to correct the dimensions of the video view's frame size by swapping the width and height as follows:

CGSize userVideoFrameSize = user.stream.videoDimensions;
CGSize userCorrectVideoFrameSize = CGSizeMake(userVideoFrame.height, userVideoFrame.width);

user may be an OTPublisher/OTPublisherKit or OTSubscriber/OTSubscriberKit.

Is this a bug in the OpenTok framework or am I doing something wrong?


Solution

  • Yes, the video dimensions were reversed. But it has been fixed in 2.6.0.

    Initially, when I contacted OpenTok developers about the problem, they did not accept it as a bug and said that the dimensions were correct and I was doing something wrong in my code. Well, I swapped the dimensions in my code to temporarily fix the problem for myself. In the next release of OpenTok, they fixed the issue.

    There was another problem with letter-boxing, I reported it to them, and they didn't accept it as a bug, and said that everything is working fine. But then they fixed it in the same release.