Skip to content

Commit

Permalink
Decrease frame rate in screen sharing and add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mekya committed Dec 19, 2024
1 parent 8b9b835 commit 195816a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ScreenShare/SampleHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@ class SampleHandler: RPBroadcastSampleHandler, AntMediaClientDelegate {
self.client.setExternalVideoCapture(externalVideoCapture: true);
}

//in some ipad versions, resolution/aspect ratio is critical to set, otherwise iOS encoder may not encode the frames and
//server side reports publishTimeout because server cannot get the video frames
self.client.setTargetResolution(width: 1280, height: 720);
self.client.setMaxVideoBps(videoBitratePerSecond: 2000000)

self.client.setExternalAudio(externalAudioEnabled: true)

//In some devices iphone version, frames are dropped due to encoder queue and it causes glitches in the playback
//Decreasing the fps provides a better playback expeience.
//Alternatively, target resolution can be decreased above to let encoder work faster
self.client.setTargetFps(fps: 10)

self.client.publish(streamId: streamId as! String);

Expand Down

0 comments on commit 195816a

Please sign in to comment.