This sample demonstrates the Amazon KinesisVideoStreams and KinesisVideoSignaling framework found in the AWS Mobile SDK for iOS.
- Xcode 10 / Xcode 11 (not supporting higher versions of Xcode yet)
- iOS 11 and later
To download the WebRTC SDK in iOS, run the following command:
git clone https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-ios.git
-
The AWS Mobile SDK for iOS is available through CocoaPods. If you have not installed CocoaPods, install CocoaPods: (Requires Ruby installed)
sudo gem install cocoapods pod setup
-
To install the AWS Mobile SDK for iOS run the following command in the directory containing this sample:
pod install
-
Create an Amazon Cognito User Pool. Follow the 4 steps under Creating your Cognito Identity user pool in this blog post.
-
Open
KinesisVideoWebRTCDemoApp.xcworkspace
(File location: KVSiOS/Swift/AWSKinesisVideoWebRTCDemoApp.xcworkspace). -
Open Constants.swift. Set CognitoIdentityUserPoolRegion, CognitoIdentityUserPoolId, CognitoIdentityUserPoolAppClientId and CognitoIdentityUserPoolAppClientSecret to the values obtained when you created your user pool.
let CognitoIdentityUserPoolRegion: AWSRegionType = .Unknown
let CognitoIdentityUserPoolId = "YOUR_USER_POOL_ID"
let CognitoIdentityUserPoolAppClientId = "YOUR_APP_CLIENT_ID"
let CognitoIdentityUserPoolAppClientSecret = "YOUR_APP_CLIENT_SECRET"
Replace the “REPLACEME” places in each of these files with the appropriate AWS Credentials:
- awsconfiguration.json (path: KVSiOS/Swift/KVSiOSApp/awsconfiguration.json)
-
_Constants.swift_ (path: KVSiOS/Swift/KVSiOSApp/Constants.swift)
- To build and run, click the play button on the XCode menu. The following step-by-step instructions describe how to download, build, and run the Kinesis Video Streams WebRTC SDK in iOS.
The following cocoa pod dependencies are included in the Podfile and need to pod installed:
- Starscream
- Common Crytpo
- WebRTC.framework: this is the GoogleWebRTC module framework package (bit code disabled).
- AWSMobileClient
- AWSCognito
- AWSKinesisVideo
- AWSKinesisVideoSignaling
Building the iOS sample application installs the AWSKinesisVideoWebRTCDemoApp on your iOS device. Using this app, you can verify live audio/video streaming between mobile, web and IoT device clients (camera). The procedure below describes some of these scenarios.
Complete the following steps:
- On your iOS device, open AWSKinesisVideoWebRTCDemoApp and login using the AWS user credentials from Set Up an AWS Account and Create an Administrator. (Note: Cognito settings can be tuned through your Cognito User Pool in the AWS management Console)
- On successful sign-in, the channel configuration view is displayed where the channel-name, client-id (optional) and region-name have to be configured.
- To run the integration tests, the test user has to be created with the appropiate test password as in the TestConstants.swift file located at amazon-kinesis-video-streams-webrtc-sdk-ios/Swift/AWSKinesisVideoWebRTCDemoAppUITests/TestConstants.swift
- Ensure that in all the cases described below, both the client applications use the same signaling channel name, region, viewer-id/client-id and the AWS account id.
- Please note that a master should be started first before the viewer connects to it.
- Start one iOS device in master mode for starting a new session using a channel name (e.g. demo). Remote peer will be joining as viewer to this master.
- Currently, there can be only one master for a channel at any given time.
- Use another iOS device to connect to the same channel name (started up in the above step set up as a master) in viewer mode. This will connect to an existing session (channel) where a master was connected previously.
Peer to Peer Streaming between Embedded SDK master and iOS device:
- Run KVS WebRTC embedded SDK (in C) in master mode on a camera device.
- Start the iOS device in viewer mode – you should be able to see the local video preview in the lower right side of the screen and also the larger part of the screen should stream the remote video view.
- Start one iOS device in master mode for starting a new session using a channel name (e.g. demo)
- Start the Web Browser using the Javascript SDK (JS with audio selected) and start it as viewer.
- Verify media showing up from the iOS device and also from the browser.
- This sample application has been tested in iPhone XS and iPhone 6.
This library is licensed under the Apache 2.0 License.