@@ -73,6 +73,7 @@ class CustomVideoSourcePushMain: BaseViewController {
7373 // layout render view
7474 remoteVideo. setPlaceholder ( text: " Remote Host " . localized)
7575 container. layoutStream ( views: [ localVideo, remoteVideo] )
76+ localVideo. backgroundColor = . black
7677
7778 // set up agora instance when view loaded
7879 let config = AgoraRtcEngineConfig ( )
@@ -113,7 +114,8 @@ class CustomVideoSourcePushMain: BaseViewController {
113114 // setup my own camera as custom video source
114115 // note setupLocalVideo is not working when using pushExternalVideoFrame
115116 // so you will have to prepare the preview yourself
116- customCamera = AgoraYUVImageSourcePush ( size: isHDR ? CGSize ( width: 1280 , height: 720 ) : CGSize ( width: 320 , height: 180 ) ,
117+ let size = isHDR ? CGSize ( width: 1280 , height: 720 ) : CGSize ( width: 320 , height: 180 )
118+ customCamera = AgoraYUVImageSourcePush ( size: size,
117119 fileName: isHDR ? " hlg-hdr " : " sample " ,
118120 frameRate: 15 ,
119121 isHDR: isHDR)
@@ -122,7 +124,7 @@ class CustomVideoSourcePushMain: BaseViewController {
122124 customCamera? . trackId = 0
123125 agoraKit. setExternalVideoSource ( true , useTexture: true , sourceType: . videoFrame)
124126
125- let resolution = ( GlobalSettings . shared. getSetting ( key: " resolution " ) ? . selectedOption ( ) . value as? CGSize ) ?? . zero
127+ let resolution = size // (GlobalSettings.shared.getSetting(key: "resolution")?.selectedOption().value as? CGSize) ?? .zero
126128 let fps = ( GlobalSettings . shared. getSetting ( key: " fps " ) ? . selectedOption ( ) . value as? AgoraVideoFrameRate ) ?? . fps15
127129 let orientation = ( GlobalSettings . shared. getSetting ( key: " orientation " ) ?
128130 . selectedOption ( ) . value as? AgoraVideoOutputOrientationMode ) ?? . fixedPortrait
@@ -221,7 +223,7 @@ extension CustomVideoSourcePushMain: AgoraRtcEngineDelegate {
221223 videoCanvas. uid = uid
222224 // the view to be binded
223225 videoCanvas. view = remoteVideo. videoView
224- videoCanvas. renderMode = . hidden
226+ videoCanvas. renderMode = . fit
225227 agoraKit? . setupRemoteVideo ( videoCanvas)
226228 }
227229
@@ -237,9 +239,6 @@ extension CustomVideoSourcePushMain: AgoraRtcEngineDelegate {
237239 // you will need to remove the EAGL sublayer from your binded view
238240 let videoCanvas = AgoraRtcVideoCanvas ( )
239241 videoCanvas. uid = uid
240- // the view to be binded
241- videoCanvas. view = nil
242- videoCanvas. renderMode = . hidden
243242 agoraKit? . setupRemoteVideo ( videoCanvas)
244243 }
245244}
0 commit comments