Amazon IVS Broadcast iOS SDK Sample Apps
This repository contains sample apps which use the Amazon IVS Broadcast iOS SDK.
Samples
- BasicBroadcast: This is the most basic example of how to get started with the SDK.
- ScreenCapture: This is a broadcast upload extension that shows how to integrate with ReplayKit.
More Documentation
Setup
- Clone the repository to your local machine.
- Ensure you are using a supported version of Ruby, as the version included with macOS is deprecated. This repository is tested with the version in
.ruby-version
, which can be used automatically with rbenv.
- Install the SDK dependency using CocoaPods. This can be done by running the following commands from the repository folder:
bundle install
bundle exec pod install --repo-update
- For more information about these commands, see Bundler and CocoaPods.
- Open
BasicBroadcast.xcworkspace
.
- Since the simulator doesn't support the use of cameras or ReplayKit, there are a couple changes you need to build for device.
- Have an active Apple Developer account in order to build to physical devices.
- Modify the Bundle Identifier for both
BasicBroadcast
and ScreenCapture
targets.
- Choose a Team for both targets.
- Create a new App Group ID based on your new Bundle Identifier for both targets, and include the targets in only that App Group.
- Modify
UserDefaultsDao
to use your newly created App Group ID.
- You can now build and run the projects on a device.
Screen Broadcasting
Project Setup
The IVS Broadcast SDK supports easy integration with ReplayKit for screen sharing. This sample app includes a target called ScreenCapture
that includes all the code necessary to screen share. By default, that target won't know what endpoint and stream key to use, so before you screen share you need to broadcast at least once using the Camera based app. It will then store your endpoint and stream key in the App Group you created in Setup, and that will be loaded when you screen share.
You can also hard code the endpoint and stream key in both the ScreenCapture
and BasicBroadcast
targets if that is easier.
Debugging
Debugging app extensions can be awkward. In order to debug the ScreenCapture
target, you need to:
- Select the
ScreenCapture
scheme from the scheme dropdown.
- Run the scheme.
- It will ask you to choose an app to launch. You can choose anything, I usually do Calculator or Calendar because they are very lightweight.
- Our
ScreenCapture
process won't launch yet, Xcode will wait and attach to the process later.
- Once the app you selected has finished launching, pull up the control center and begin a screen recording session through the system UI, selecting
ScreenCapture
as your recorder.
- After the 3, 2, 1 countdown on your device, the system will launch our process and Xcode should attach to it. At this point you can debug and use console logs.
License
This project is licensed under the MIT-0 License. See the LICENSE file.