client-sdk-swift
client-sdk-swift copied to clipboard
How to restrict orientation of video capturing in LiveKit ?
How to restrict orientation of video capturing in LiveKit ?
Hi @Choprarahul , I think I will try to introduce a property to CameraCapturer to override orientation to preferred value.
Is this bug in the current release ? @hiroshihorie
I don't think this is a bug , can I have details of the problem ?
When i rotate the phone from portrait to landscape, then video lagging. @hiroshihorie
@Choprarahul Is it a short lag ?
Is there any property for auto rotate ?
When one user connected with the other user. Then, first user will rotate his screen in landscape mode. Then at the second user's end, the first user view is lagging (always shown in portrait mode but in zoomed).
NotificationCenter.default.addObserver(self, selector: #selector(rotated), name: UIDevice.orientationDidChangeNotification, object: nil)
@objc func rotated() {
if isRemoteConnected {
remoteVideoView.rotationOverride = ._0
}
switch UIDevice.current.orientation {
case .portrait:
print("portrait")
if !isRemoteConnected {
remoteVideoView.rotationOverride = ._0
} else {
localVideoView.rotationOverride = ._0
}
case .portraitUpsideDown:
if !isRemoteConnected {
remoteVideoView.rotationOverride = ._180
} else {
remoteVideoView.rotationOverride = ._0
}
case .landscapeLeft:
if !isRemoteConnected {
remoteVideoView.rotationOverride = isCameraSwitched ? ._90 : ._270
} else {
localVideoView.rotationOverride = isCameraSwitched ? ._90 : ._270
}
print("landscapeLeft")
case .landscapeRight:
if !isRemoteConnected {
remoteVideoView.rotationOverride = isCameraSwitched ? ._270 : ._90
} else {
localVideoView.rotationOverride = isCameraSwitched ? ._90 : ._270
}
print("landscapeRight")
default:
print("default")
}
}