Skip to content

Commit fe1583b

Browse files
authored
Release 1.2.0 (#114)
* Add Instructions for App Client Authentication without Client Secret (#111) * Fix numbering in and add no-secret case directions to README installation instructions * Cleanup spacing * Update referenced step number * Dual-Stack Endpoint Support (#112) * Add UI elements for endpoint type selection, cleanup spacing of elements * Improve endpoint switch UI * Add handling of the dual-stack UI switch * Add styling and animation for switch selection * Add storyboard changes, fix typo and syntax * Add dual-stack stun server * Improve UI * Fix text color for dark-themed devices * Remove non-supported CI OS versions * Update CI workflow with new macOS and Xcode versions * Update app version to 1.2.0 (#113)
1 parent c2c59d4 commit fe1583b

5 files changed

Lines changed: 255 additions & 152 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
strategy:
1515
matrix:
1616
config: [
17-
{mac_ver: "13", xc_ver: "15.2", os: "17.2", iphone_ver: "14"},
18-
{mac_ver: "14", xc_ver: "15.4", os: "17.5", iphone_ver: "15"},
17+
{mac_ver: "15-intel", xc_ver: "16.4", os: "18.6", iphone_ver: "16e"},
18+
{mac_ver: "15-intel", xc_ver: "16.4", os: "18.6", iphone_ver: "16 Pro"},
1919
{mac_ver: "15", xc_ver: "16.4", os: "18.6", iphone_ver: "16e"},
2020
{mac_ver: "15", xc_ver: "16.4", os: "18.6", iphone_ver: "16 Pro"}
2121
]
@@ -48,8 +48,8 @@ jobs:
4848
strategy:
4949
matrix:
5050
config: [
51-
{mac_ver: "13", xc_ver: "15.2", os: "17.2", iphone_ver: "14"},
52-
{mac_ver: "14", xc_ver: "15.4", os: "17.5", iphone_ver: "15"},
51+
{mac_ver: "15-intel", xc_ver: "16.4", os: "18.6", iphone_ver: "16e"},
52+
{mac_ver: "15-intel", xc_ver: "16.4", os: "18.6", iphone_ver: "16 Pro"},
5353
{mac_ver: "15", xc_ver: "16.4", os: "18.6", iphone_ver: "16e"},
5454
{mac_ver: "15", xc_ver: "16.4", os: "18.6", iphone_ver: "16 Pro"}
5555
]

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ git clone https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-ios
2727

2828
#### Using XCode to build the project
2929

30-
0. Install XCode. You can install XCode from https://developer.apple.com/download/all/
30+
1. Install XCode. You can install XCode from https://developer.apple.com/download/all/
3131

32-
1. The [AWS Mobile SDK for iOS](https://github.com/aws-amplify/aws-sdk-ios) is available through [CocoaPods](http://cocoapods.org). If CocoaPods is not installed, install it using the following command. Note that Ruby will also be installed, as it is a dependency of Cocoapods.
32+
2. The [AWS Mobile SDK for iOS](https://github.com/aws-amplify/aws-sdk-ios) is available through [CocoaPods](http://cocoapods.org). If CocoaPods is not installed, install it using the following command. Note that Ruby will also be installed, as it is a dependency of Cocoapods.
3333
```bash
3434
brew install cocoapods
3535
pod setup
3636
```
3737

38-
2. The following cocoa pod dependencies are included in the [Podfile](Swift/Podfile) and need to be `pod install`'ed:
38+
3. The following cocoa pod dependencies are included in the [Podfile](Swift/Podfile) and need to be `pod install`'ed:
3939

4040
* Starscream
4141
* Common Crytpo
@@ -52,17 +52,23 @@ git clone https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-ios
5252
pod install --repo-update
5353
```
5454

55-
3. Create an [Amazon Cognito User Pool](https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html). Follow steps 2-3 in the [AWS KVS Android WebRTC Repo](https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-android).
55+
4. Create an [Amazon Cognito User Pool](https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html). Follow steps 2-3 in the [AWS KVS Android WebRTC Repo](https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-android).
5656

57-
4. To open the project, you can choose between these two methods:
57+
5. To open the project, you can choose between these two methods:
5858

5959
1. Open XCode, select "Open a project or file", and choose [AWSKinesisVideoWebRTCDemoApp.**xcworkspace**](Swift/AWSKinesisVideoWebRTCDemoApp.xcworkspace), **OR**
6060
2. Run the following command from the [Swift](Swift) folder.
6161
```bash
6262
xed .
6363
```
6464

65-
5. Open [KvsiOSApp/Constants.swift](Swift/KVSiOSApp/Constants.swift). Set `CognitoIdentityUserPoolRegion`, `CognitoIdentityUserPoolId`, `CognitoIdentityUserPoolAppClientId`, `CognitoIdentityUserPoolAppClientSecret` and `CognitoIdentityPoolId` to the values obtained in step 3.
65+
6. Open [KvsiOSApp/Constants.swift](Swift/KVSiOSApp/Constants.swift). Set `CognitoIdentityUserPoolRegion`, `CognitoIdentityUserPoolId`, `CognitoIdentityUserPoolAppClientId`, `CognitoIdentityUserPoolAppClientSecret` and `CognitoIdentityPoolId` to the values obtained in step 4.
66+
67+
> [!NOTE]
68+
> If the User-Pool App-Client does not have a secret, then set `cognitoIdentityUserPoolAppClientSecret` to `nil`:
69+
> ```
70+
> let cognitoIdentityUserPoolAppClientSecret: String? = nil
71+
> ```
6672

6773
<details>
6874
<summary><strong>Example Constants.swift</strong></summary>
@@ -74,11 +80,16 @@ git clone https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-ios
7480
let cognitoIdentityUserPoolAppClientSecret = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmno"
7581
let cognitoIdentityPoolId = "us-west-2:01234567-89ab-cdef-0123-456789abcdef"
7682
```
77-
7883
</details>
7984

8085
Open [KvsiOSApp/awsconfiguration.json](Swift/KVSiOSApp/awsconfiguration.json) and replace the "REPLACEME" values with the values obtained earlier.
8186

87+
> [!NOTE]
88+
> If the User-Pool App-Client does not have a secret, then remove the following line from _awsconfiguration.json_:
89+
> ```
90+
> "AppClientSecret": "REPLACEME",
91+
> ```
92+
8293
<details>
8394
<summary><strong>Example awsconfiguration.json</strong></summary>
8495

@@ -109,7 +120,7 @@ git clone https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-ios
109120

110121
</details>
111122

112-
6. To build and run, click the play button at the top of the XCode UI.
123+
7. To build and run, click the play button at the top of the XCode UI.
113124

114125
#### Run the iOS Sample Application
115126
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.

Swift/KVSiOSApp/ChannelConfigurationViewController.swift

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class ChannelConfigurationViewController: UIViewController, UITextFieldDelegate
3737
var isMaster: Bool = false
3838
var signalingConnected: Bool = false
3939
var selectedResolution: VideoResolution = .resolution720p
40+
var useDualStackKvsEndpoint: Bool = false
4041

4142
// clients for WEBRTC Connection
4243
var signalingClient: SignalingClient?
@@ -53,6 +54,7 @@ class ChannelConfigurationViewController: UIViewController, UITextFieldDelegate
5354
@IBOutlet var channelName: UITextField!
5455
@IBOutlet var clientID: UITextField!
5556
@IBOutlet var regionName: UITextField!
57+
@IBOutlet var useDualStackKvsEndpointSwitch: UISwitch!
5658
@IBOutlet var isAudioEnabled: UISwitch!
5759
@IBOutlet var isVideoEnabled: UISwitch!
5860
@IBOutlet var resolutionButton: UIButton!
@@ -80,6 +82,33 @@ class ChannelConfigurationViewController: UIViewController, UITextFieldDelegate
8082
return AWSMobileClient.default()
8183
}
8284

85+
// Helper function to get KVS endpoint override if specified.
86+
private func getKvsEndpointOverride()-> String? {
87+
88+
// Environment variable override takes precedence.
89+
if let envVarOverride = kvsControlPlaneOverride, !envVarOverride.isEmpty {
90+
return envVarOverride
91+
}
92+
93+
// If using dual-stack endpoint format, construct the appropriate endpoint using the region name.
94+
if self.useDualStackKvsEndpoint {
95+
96+
guard let regionText = self.regionName.text?.trim(),
97+
!regionText.isEmpty else {
98+
return nil
99+
}
100+
101+
if regionText.hasPrefix("cn-") {
102+
return String(format: PROD_CONTROL_PLANE_ENDPOINT_FORMAT_DUAL_STACK_CN, regionText)
103+
}
104+
105+
return String(format: PROD_CONTROL_PLANE_ENDPOINT_FORMAT_DUAL_STACK, regionText)
106+
}
107+
108+
return nil
109+
}
110+
111+
83112
override func viewDidAppear(_ animated: Bool) {
84113
super.viewDidAppear(true)
85114
self.signalingConnected = false
@@ -113,20 +142,16 @@ class ChannelConfigurationViewController: UIViewController, UITextFieldDelegate
113142
navigationController?.setToolbarHidden(false, animated: true)
114143
}
115144

145+
@IBAction func kvsEndpointStateChanged(sender: UISwitch!) {
146+
self.useDualStackKvsEndpoint = sender.isOn
147+
}
148+
116149
@IBAction func audioStateChanged(sender: UISwitch!) {
117-
if sender.isOn {
118-
self.sendAudioEnabled = true
119-
} else {
120-
self.sendAudioEnabled = false
121-
}
150+
self.sendAudioEnabled = sender.isOn
122151
}
123152

124153
@IBAction func videoStateChanged(sender: UISwitch!) {
125-
if sender.isOn {
126-
self.sendVideoEnabled = true
127-
} else {
128-
self.sendVideoEnabled = false
129-
}
154+
self.sendVideoEnabled = sender.isOn
130155
}
131156

132157
@IBAction func resolutionButtonTapped(_ sender: UIButton) {
@@ -221,7 +246,7 @@ class ChannelConfigurationViewController: UIViewController, UITextFieldDelegate
221246
}
222247
// Kinesis Video Client Configuration
223248
let configuration = AWSServiceConfiguration(region: awsRegionType,
224-
endpoint: kvsControlPlaneOverride.map { AWSEndpoint(urlString: $0) },
249+
endpoint: getKvsEndpointOverride().map { AWSEndpoint(urlString: $0) },
225250
credentialsProvider: getCredentialsProvider())
226251
AWSKinesisVideo.register(with: configuration!, forKey: awsKinesisVideoKey)
227252

@@ -252,7 +277,7 @@ class ChannelConfigurationViewController: UIViewController, UITextFieldDelegate
252277
}
253278

254279
// get signalling channel endpoints
255-
let endpoints = getSignallingEndpoints(channelARN: channelARN!, region: awsRegionValue, isMaster: self.isMaster, useStorageSession: useStorageSession)
280+
let endpoints = getSignallingEndpoints(channelARN: channelARN!, awsRegionValue: awsRegionValue, isMaster: self.isMaster, useStorageSession: useStorageSession)
256281
//// Ensure that the WebSocket (WSS) endpoint is available; WebRTC requires a valid signaling endpoint.
257282
if endpoints["WSS"] == nil {
258283
popUpError(title: "Invalid SignallingEndpoints", message: "SignallingEndpoints is required for WebRTC connection")
@@ -385,7 +410,13 @@ class ChannelConfigurationViewController: UIViewController, UITextFieldDelegate
385410
func getIceCandidates(channelARN: String, endpoint: AWSEndpoint, regionType: AWSRegionType, clientId: String) -> [RTCIceServer] {
386411
var RTCIceServersList = [RTCIceServer]()
387412
// TODO: don't use the self.regionName.text!
388-
let kvsStunUrlStrings = ["stun:stun.kinesisvideo." + self.regionName.text! + ".amazonaws.com:443"]
413+
414+
let kvsStunUrlStrings: [String]
415+
if self.useDualStackKvsEndpoint {
416+
kvsStunUrlStrings = ["stun:stun.kinesisvideo." + self.regionName.text! + ".api.aws:443"]
417+
} else {
418+
kvsStunUrlStrings = ["stun:stun.kinesisvideo." + self.regionName.text! + ".amazonaws.com:443"]
419+
}
389420
/*
390421
equivalent AWS CLI command:
391422
aws kinesis-video-signaling get-ice-server-config --channel-arn channelARN --client-id clientId --region cognitoIdentityUserPoolRegion
@@ -418,7 +449,7 @@ class ChannelConfigurationViewController: UIViewController, UITextFieldDelegate
418449
}
419450

420451
// Get signalling endpoints for the given signalling channel ARN
421-
func getSignallingEndpoints(channelARN: String, region: String, isMaster: Bool, useStorageSession: Bool) -> Dictionary<String, String?> {
452+
func getSignallingEndpoints(channelARN: String, awsRegionValue: String, isMaster: Bool, useStorageSession: Bool) -> Dictionary<String, String?> {
422453

423454
var endpoints = Dictionary <String, String?>()
424455
/*

Swift/KVSiOSApp/Constants.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let cognitoIdentityPoolId = "REPLACEME"
1212

1313
// App constants
1414
let appName = "aws-kvs-webrtc-ios-client"
15-
let appVersion = "1.1.0"
15+
let appVersion = "1.2.0"
1616

1717
// KinesisVideo constants
1818
let awsKinesisVideoKey = "kinesisvideo"
@@ -59,3 +59,7 @@ let awsAccessKey: String? = ProcessInfo.processInfo.environment["AWS_ACCESS_KEY_
5959
let awsSecretKey: String? = ProcessInfo.processInfo.environment["AWS_SECRET_ACCESS_KEY"]
6060
let awsSessionToken: String? = ProcessInfo.processInfo.environment["AWS_SESSION_TOKEN"]
6161
let kvsControlPlaneOverride: String? = ProcessInfo.processInfo.environment["CONTROL_PLANE_URI"]
62+
63+
// Dual-stack endpoint formats.
64+
let PROD_CONTROL_PLANE_ENDPOINT_FORMAT_DUAL_STACK = "https://kinesisvideo.%@.api.aws"
65+
let PROD_CONTROL_PLANE_ENDPOINT_FORMAT_DUAL_STACK_CN = "https://kinesisvideo.%@.api.amazonwebservices.com.cn"

0 commit comments

Comments
 (0)