aws-samples / amazon-ivs-broadcast-ios-sample

MIT No Attribution
18 stars 11 forks source link

Screen Broadcasting not working on iOS 13, 14 with Xcode 12, 13 #14

Closed arpitthinglogix closed 2 years ago

arpitthinglogix commented 2 years ago

Implementation of Screen capture is not working iOS its not starting the screen Broadcasting as expected. I tried to implement with the source code as given in example with app group and app extension of ScrrenCapture.

Can you please advise if Screen Brodcast is working with Amazon IVS in this library as expected or not.

bclymer commented 2 years ago

Hi @arpitthinglogix , could you provide more details about what isn't working? Screen Broadcasting should be working correctly. Please make sure you followed the steps in the README about setting up your App Group ID. You can also hardcode your configuration in SampleHandler.swift instead.

arpitthinglogix commented 2 years ago

Hi @bclymer The main issue is when we switch stream resource from camera to screen broadcast that shows a error message that - The live broadcast to app is stopped due to: - Could not start the stream ... as shown in attached screenshot.

so whenever we try to stream from one source first we have to stop it then we will be able to start screen broadcast that shows glitches on viewer side.

And this has not implemented properly on the sample given here in iOS similar to android?

bclymer commented 2 years ago

As you've noticed, you're required to stop the existing stream and start a new stream on iOS. This is because Apple requires all screen capture apps to use their ReplayKit framework, which runs in a separate process as an App Extension. Because it runs in a separate process, we can not easily hand of the video broadcast session to make the transition seamless. At the moment you are required to call stop() on your host-app session, and then create and call start on a new ReplayKit-based session. Not calling stop() on the old session will lead to the error you posted.

Android works differently because the OS allows for screen capture in the same process as the rest of the application.