Intel® Collaboration Suite for WebRTC
Community support and discussions on the Intel® Collaboration Suite for WebRTC (Intel® CS for WebRTC).
1144 Discussions

iOS: Streaming landscape resolution when holding phone in portrait orientation


As the title suggests I want to record a stream holding the phone upright (portrait oriented) and have it cropped to landscape orientation, so the receiving end always sees a landscape video no matter the phones orientation. Coming from an Android project this was a relatively easy task, as I was able to access the VideoSource object which has adaptOutputFormat that did all of that for me.


OWT for iOS provides two ways (as I see it) to set up a stream. The OWTLocalStream class offers two initializers:







The first option just needs you to pass simple constraints, such as resolution and fps, and all the rest happens under the hood automatically.








The second option gives you a little more possibilities as you provide the media stream yourself and have a lot more possibilities (you even have access to the VideoSource object). Unfortunately I was not able to get this option to work and I was not able to find any working examples on the internet.

Let me post what I have so far... maybe you can help. Or maybe there is another solution to my initial problem.




let peerConnectionFactory = RTCPeerConnectionFactory.sharedInstance()
            if let peerConnectionFactory = peerConnectionFactory {
                let videoSource = peerConnectionFactory.videoSource()

                let capturer = RTCCameraVideoCapturer.init(delegate: videoSource)

                let videoTrack = peerConnectionFactory.videoTrack(with: videoSource, trackId: "testVideo")
                let audioTrack = peerConnectionFactory.audioTrack(withTrackId: "testAudio")

                let mediaStream = peerConnectionFactory.mediaStream(withStreamId: "testStream")

                let sourceInfo = OWTStreamSourceInfo()
       = .mic
       = .camera

                let stream = OWTLocalStream.init(mediaStream: mediaStream, source: sourceInfo)

                let publishOptions = OWTPublishOptions.init()

                let opusParameter = OWTAudioCodecParameters.init()
       = OWTAudioCodec.opus
                let audioEncodingParameter = OWTAudioEncodingParameters.init()
                audioEncodingParameter.codec = opusParameter

       = [audioEncodingParameter]

                let h264Parameter = OWTVideoCodecParameters.init()
       = OWTVideoCodec.H264
                let videoEncodingParamter = OWTVideoEncodingParameters.init()
                videoEncodingParamter.codec = h264Parameter

       = [videoEncodingParamter]

                let device = AVCaptureDevice.default(for: .video)
                self.conferenceClient!.publish(stream, with: publishOptions, onSuccess: { publication in
                    capturer.startCapture(with: device!, format: device!.activeFormat, fps: 24)

                }, onFailure: { error in






0 Kudos
0 Replies