@@ -239,20 +239,12 @@ class LocalCompositeGraph: BaseViewController {
239239 self . showAlert ( title: " Error " , message: " startScreenCapture call failed: \( result) , please check your params " )
240240 } else {
241241 isScreenSharing = true
242- let mediaOptions = AgoraRtcChannelMediaOptions ( )
243- // mediaOptions.publishCameraTrack = false
244- // mediaOptions.publishScreenTrack = true
245- agoraKit. updateChannel ( with: mediaOptions)
246242 agoraKit. startPreview ( )
247243 setupLocalPreview ( isScreenSharing: true )
248244 }
249245 } else {
250246 agoraKit. stopScreenCapture ( )
251247 isScreenSharing = false
252- let mediaOptions = AgoraRtcChannelMediaOptions ( )
253- // mediaOptions.publishCameraTrack = true
254- // mediaOptions.publishScreenTrack = false
255- agoraKit. updateChannel ( with: mediaOptions)
256248 agoraKit. startPreview ( )
257249 setupLocalPreview ( isScreenSharing: false )
258250 }
@@ -288,17 +280,26 @@ class LocalCompositeGraph: BaseViewController {
288280 private func videoTranscoderHandler( isTranscoder: Bool ) {
289281 if isTranscoder {
290282 let captureConfig = AgoraCameraCapturerConfiguration ( )
291- captureConfig. dimensions = videos [ 1 ] . videocanvas . bounds . size
283+ captureConfig. dimensions = CGSize ( width : 100 , height : 100 )
292284 agoraKit. startCameraCapture ( . camera, config: captureConfig)
293- let config = AgoraLocalTranscoderConfiguration ( )
285+
294286 let cameraStream = AgoraTranscodingVideoStream ( )
295- cameraStream. rect = NSRect ( origin: NSPoint ( x: 250 , y: 0 ) , size: NSSize ( width: 100 , height: 100 ) )
287+ cameraStream. rect = NSRect ( origin: NSPoint ( x: 150 , y: 0 ) , size: NSSize ( width: 100 , height: 100 ) )
296288 cameraStream. sourceType = . camera
289+
290+ let size = NSScreen . main? . visibleFrame. size ?? . zero
291+
297292 let screenStream = AgoraTranscodingVideoStream ( )
298293 screenStream. sourceType = . screen
299- screenStream. rect = NSScreen . main? . visibleFrame ?? . zero
300- config. videoInputStreams = [ cameraStream, screenStream]
294+ screenStream. rect = CGRect ( origin: CGPoint ( x: 0 , y: 0 ) , size: size)
295+
296+ let config = AgoraLocalTranscoderConfiguration ( )
297+ config. videoInputStreams = [ screenStream, cameraStream]
298+ config. videoOutputConfiguration. dimensions = size
299+
301300 agoraKit. startLocalVideoTranscoder ( config)
301+
302+
302303 let mediaOptions = AgoraRtcChannelMediaOptions ( )
303304 mediaOptions. publishTranscodedVideoTrack = true
304305 agoraKit. updateChannel ( with: mediaOptions)
0 commit comments