client-sdk-swift icon indicating copy to clipboard operation
client-sdk-swift copied to clipboard

How to restrict orientation of video capturing in LiveKit ?

Open Choprarahul opened this issue 2 years ago • 8 comments

How to restrict orientation of video capturing in LiveKit ?

Choprarahul avatar Dec 26 '22 16:12 Choprarahul

Hi @Choprarahul , I think I will try to introduce a property to CameraCapturer to override orientation to preferred value.

hiroshihorie avatar Dec 28 '22 07:12 hiroshihorie

Is this bug in the current release ? @hiroshihorie

Choprarahul avatar Dec 28 '22 07:12 Choprarahul

I don't think this is a bug , can I have details of the problem ?

hiroshihorie avatar Dec 28 '22 08:12 hiroshihorie

When i rotate the phone from portrait to landscape, then video lagging. @hiroshihorie

Choprarahul avatar Dec 28 '22 14:12 Choprarahul

@Choprarahul Is it a short lag ?

hiroshihorie avatar Dec 29 '22 17:12 hiroshihorie

Is there any property for auto rotate ?

Choprarahul avatar Jan 02 '23 14:01 Choprarahul

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).

Choprarahul avatar Jan 02 '23 15:01 Choprarahul

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")
        }
    }

Choprarahul avatar Jan 02 '23 15:01 Choprarahul