This repository contains a demo app, which shows how to use the Amazon IVS Broadcast SDK to create a mobile streaming app on iOS using SwiftUI.
- Clone the repository to your local machine.
- Install the SDK dependency using CocoaPods. This can be done by running the following commands from the repository folder:
- Open
Broadcasting.xcworkspace
. - Since the simulator doesn't support the use of cameras or ReplayKit, there are a couple changes you need to make before building and running the app on a physical device.
- Have an active Apple Developer account in order to build to physical devices.
- Modify the Bundle Identifier for both
Broadcasting
andReplayKitBroadcaster
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
appGroupName
(can be found inHelpers/Constants.swift
) to use your newly created App Group ID.
- (Optional)* Refer to the Streaming to Amazon IVS section of this readme to set up the app for streaming.
- You can now build and run the projects on a device.
*You can run and build this app without an Amazon IVS Channel, but you will need an Amazon IVS Channel in order to start broadcasting.
IMPORTANT NOTE: Using your own stream will create and consume AWS resources, which will cost money.
- Create and set up an Amazon IVS channel. A guide is available here: Getting started with Amazon IVS.
- Open the Amazon IVS Console and navigate to the channel you would like to use.
- Open
Helpers/Constants.swift
and find lines 16 - 18. - Copy the Ingest Server for the channel and paste it into the
ingestServer
field on line 16 between the quotes. The resulting line should look like the following:static let ingestServer = "rtmps://<ingest_server_url>:443/app/"
- Copy the Stream Key for the channel and paste it into the
streamKey
field on line 17 between the quotes. - Copy the Playback URL for the channel and paste it into the
playbackUrl
field on line 18 between the quotes. - Save and run the application.
You can also change the values for any of these fields in the app settings once you have launched the app on a physical iPhone.
- This app has only been tested on devices running iOS 14 or later. While this app may work on devices running older versions of iOS, it has not been tested on them.
This project is licensed under the MIT-0 License. See the LICENSE file.