Coder Social home page Coder Social logo

awslabs / amazon-kinesis-video-streams-webrtc-sdk-ios Goto Github PK

View Code? Open in Web Editor NEW
59.0 15.0 28.0 23.11 MB

iOS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.

License: Apache License 2.0

Swift 99.14% Ruby 0.86%
webrtc-sdk camera xcode video-streaming swift cocoapods peer-streaming

amazon-kinesis-video-streams-webrtc-sdk-ios's Introduction

Amazon Kinesis Video iOS WebRTC Sample

Build Status License

This sample demonstrates the Amazon Kinesis Video Streams and Kinesis Video Signaling framework found in the AWS Mobile SDK for iOS with Google WebRTC.

For more information, see What Is Amazon Kinesis Video Streams with WebRTC and WebRTC SDK for iOS. You can learn more about Google WebRTC's native API's here.

Requirements

  • See ci.yml for supported iOS and XCode versions.

Download the WebRTC SDK in iOS

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

Using XCode to build the project

  1. Install XCode. You can install XCode from https://developer.apple.com/download/all/

  2. The AWS Mobile SDK for iOS is available through CocoaPods. 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.

    brew install cocoapods
    pod setup
  3. The following cocoa pod dependencies are included in the Podfile and need to be pod install'ed:

    • Starscream
    • Common Crytpo
    • WebRTC.framework: this is the GoogleWebRTC module framework package (bit code disabled).
    • AWSMobileClient
    • AWSCognito
    • AWSKinesisVideo
    • AWSKinesisVideoSignaling

    Change directories to the directory containing the Podfile and run the install command:

    cd amazon-kinesis-video-streams-webrtc-sdk-ios/Swift
    pod cache clean --all
    pod install --repo-update
  4. Create an Amazon Cognito User Pool. Follow steps 2-3 in the AWS KVS Android WebRTC Repo.

  5. To open the project, you can choose between these two methods:

    1. Open XCode, select "Open a project or file", and choose AWSKinesisVideoWebRTCDemoApp.xcworkspace, OR
    2. Run the following command from the Swift folder.
    xed .
  6. Open KvsiOSApp/Constants.swift. Set CognitoIdentityUserPoolRegion, CognitoIdentityUserPoolId, CognitoIdentityUserPoolAppClientId, CognitoIdentityUserPoolAppClientSecret and CognitoIdentityPoolId to the values obtained in step 3.

    Example Constants.swift
    let cognitoIdentityUserPoolRegion = AWSRegionType.USWest2
    let cognitoIdentityUserPoolId = "us-west-2_qRsTuVwXy"
    let cognitoIdentityUserPoolAppClientId = "0123456789abcdefghijklmnop"
    let cognitoIdentityUserPoolAppClientSecret = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmno"
    let cognitoIdentityPoolId = "us-west-2:01234567-89ab-cdef-0123-456789abcdef"

    Open KvsiOSApp/awsconfiguration.json and replace the "REPLACEME" values with the values obtained earlier.

    Example awsconfiguration.json
    {
      "Version": "1.0",
      "CredentialsProvider": {
        "CognitoIdentity": {
          "Default": {
            "PoolId": "us-west-2:01234567-89ab-cdef-0123-456789abcdef",
            "Region": "us-west-2"
          }
        }
      },
      "IdentityManager": {
        "Default": {}
      },
      "CognitoUserPool": {
        "Default": {
          "AppClientSecret": "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmno",
          "AppClientId": "0123456789abcdefghijklmnop",
          "PoolId": "us-west-2_qRsTuVwXy",
          "Region": "us-west-2"
        }
      }
    }
  7. To build and run, click the play button at the top of the XCode UI.

Run the iOS Sample Application

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:

  1. 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)
  2. On successful sign-in, the channel configuration view is displayed where the channel-name, client-id (optional) and region-name have to be configured.

Run the Integration Tests

  1. To run the integration tests, the test user has to be created with the appropriate test password as in the AWSKinesisVideoWebRTCDemoAppUITests/TestConstants.swift file.
Note
  • 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.
Peer to Peer Streaming between two iOS devices: master and viewer:
  • 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.
Peer to Peer Streaming between iOS device as master and Web browser as viewer:
  • 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.
Note
  • This sample application has been tested in iPhone XS and iPhone 6.

Troubleshooting

Scripting Bridge could not launch application /Applications/Xcode.app

Check that XCode.app is in your Applications folder.


No such module 'AWSCognitoIdentityProvider'

Open the project by selecting the .xcworkspace file or using the xed . command, not the .xcodeproj file.


Could not build module 'UIKit'

Try reinstalling XCode, restarting your MAC, and reinstalling the Pods. Run the following commands from the same directory containing the Podfile.

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData
pod deintegrate
rm -f Podfile.lock
pod setup
pod install --repo-update

Then, run a clean build in XCode by going to Product > Clean Build Folder (or using ⌘+⇧+K) before clicking the play button.


Could not find module 'AWSMobileClient' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator

Open Build settings.

  • In XCode, switch to the file viewer, scroll down and double-click on the Pods with the XCode symbol next to it. At the top, switch the tab to Build settings, and check that All and Combined are selected.

In the Architectures > Architectures setting, add x86_64.

Alternatively, you can try enabling Rosetta: Finder > Applications > XCode > Get Info > ✓ Enable Rosetta


Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid region type.'

Double check that Constants.swift contains a valid region. See AWSRegionType for more info.


Unable to create channel. Please validate all the input fields

Check that the values in Constants.swift and awsconfiguration.json are set correctly. See the examples above to ensure your values match the same format. Additionally, check that the IAM role has the appropriate kinesisvideo permissions.

License

This library is licensed under the Apache 2.0 License.

amazon-kinesis-video-streams-webrtc-sdk-ios's People

Contributors

amazon-auto avatar ankitsaini56 avatar disa6302 avatar dswamina avatar niyatim23 avatar sirknightj avatar stefankiesz avatar unicornss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amazon-kinesis-video-streams-webrtc-sdk-ios's Issues

use webrtc-sdk-ios the ipa will increased about 25M

hi
When i add the sdk to mine project, i found that the ipa increased about 25M ?
I found it contains these(AWSCognitoIdentityProvider AWSMobileClient AWSKinesisVideo AWSKinesisVideoSignaling GoogleWebRTC)
Are these necessary?

When i add the Android sdk to mine project ,the apk just increased about 2M ,so the size of iOS can be Compressed? thx

User is Nil

I tried to signup and signIn many time, but I got the issue below :
AWSKinesisVideoWebRTCDemoApp[2396:1264493] AWSMobileClient/AWSMobileClientExtensions.swift:229: Fatal error: Unexpectedly found nil while unwrapping an Optional value

I tried to debug and see the the User is Nil. How can I fix that?
Thanks.
Screen Shot 2021-10-29 at 09 21 43

Multiple viewer unable to connect simultaneously

When a single master publishing Audio-video stream and 1 viewer is subscribing that stream and another viewer wants to subscribe then the whole system hangs and the publisher stops working

Scenario Steps:

  1. Master starts publishing the stream on channel ‘A’
  2. Viewer V1 connects and subscribe Channel A’ and can see and publish Audio-video
  3. Viewer V2 connects and want to subscribe to the Channel ‘A’

Expected Result: Both viewer and the master simultaneously
Result Observed: When V2 connects then all Master viewers stuck

Multiple Viewer Issue

Hi,
I'm using https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-js/examples/index.html and https://eu-central-1.console.aws.amazon.com/kinesisvideo links for test kinesis system. I'm using multiple-viewe-sample branch for test.

My attempts;

Attempt 1 - ✅ Worked
Master -> My Device (iPhone 11) (Video rendering is working)
Viewer1 -> AwsLabs (Video rendering is working)
Viewer2 -> https://eu-central-1.console.aws.amazon.com/kinesisvideo (Video rendering is working)

Attempt 2 - ❌ Not Worked on Viewer2
Master -> AwsLabs (Video rendering is working)
Viewer1 -> https://eu-central-1.console.aws.amazon.com/kinesisvideo (Video rendering is working)
Viewer2 -> My Device (iPhone 11) (Video rendering is not working. Video is not exist)

Attempt 3 - ❌ Not Worked on All
Master -> My Device (iPhone 11) (Video rendering is not working. Video is not exist)
Viewer1 -> My Friend's Device (Video rendering is not working. Video is not exist)

Attempt 4- ❌ Not Worked on All
Master -> My Friend's Device (Video rendering is not working. Video is not exist)
Viewer1 -> My Device (iPhone 11) (Video rendering is not working. Video is not exist)

Persisting or storing the stream in kinesis video stream

Hi I understand we can send video peer-to-peer from :

  • IOS device to iOS device
  • iOS device to embedded SDK
  • IOS device to web browser

However is there a method to send the video to "kinesis video stream" as we do in producer SDK of Android or C or C++ producer SDK for storing purpose. . .

I do not want to send from one device to another device. . . I want to send from iOS device to store in Kinesis video stream. . .

awslabs/amazon-kinesis-video-streams-webrtc-sdk-android#36 (comment) mentions "one of the ways I suggest is to run dual streaming mode where there is a parallel stream being uploaded to KVS." but there is no documentation on how to perform the same. . . I do not want parallel stream, I want only one stream to be uploaded to KVS. . . Kindly shed some light and provide a required documentation. . .

[Question] Is there an example / sample code on how to use webrtc viewer in flutter

I am developing an app using flutter where I am trying to implement a webrtc viewer that will start a peer to peer Streaming between [Embedded SDK] master and iOS device. I was not able to find a flutter implementation.

Can you suggest if there is any doc on how to use this sdk in flutter (via channel) or point me to kinesis-webrtc-sdk-flutter.

dyld: Library not loaded error on iOS 13.3.1

I built the iOS sample application by following the instructions on README.md.
It worked fine on the simulator but had error below on real devices (iPhone 11 and iPad with iOS 13.3.1).

dyld: Library not loaded: @rpath/AWSAuthCore.framework/AWSAuthCore
  Referenced from: /private/var/containers/Bundle/Application/5A196EC7-9148-4370-81BA-4EB518987940/AWSKinesisVideoWebRTCDemoApp.app/AWSKinesisVideoWebRTCDemoApp
  Reason: no suitable image found.  Did find:
	/private/var/containers/Bundle/Application/5A196EC7-9148-4370-81BA-4EB518987940/AWSKinesisVideoWebRTCDemoApp.app/Frameworks/AWSAuthCore.framework/AWSAuthCore: code signature invalid for '/private/var/containers/Bundle/Application/5A196EC7-9148-4370-81BA-4EB518987940/AWSKinesisVideoWebRTCDemoApp.app/Frameworks/AWSAuthCore.framework/AWSAuthCore'

	/private/var/containers/Bundle/Application/5A196EC7-9148-4370-81BA-4EB518987940/AWSKinesisVideoWebRTCDemoApp.app/Frameworks/AWSAuthCore.framework/AWSAuthCore: code signature invalid for '/private/var/containers/Bundle/Application/5A196EC7-9148-4370-81BA-4EB518987940/AWSKinesisVideoWebRTCDemoApp.app/Frameworks/AWSAuthCore.framework/AWSAuthCore'

	/private/var/containers/Bundle/Application/5A196EC7-9148-4370-81BA-4EB518987940/AWSKinesisVideoWebRTCDemoApp.app/Frameworks/AWSAuthCore.framework/AWSAuthCore: stat() failed with errno=1
	/private/var/containers/Bundle/Application/5A196EC7-9148-4370-81BA-4EB518987940/AWSKinesisVideoWebRTCDemoApp.app/Frameworks/AWSAuthCore.framework/AWSAuthCore: code signature invalid for '/private/var/containers/Bundle/Application/5A196EC7-9148-4370-81BA-4EB518987940/AWSKinesisVideoWebRTCDemoApp.app/Frameworks/AWSAuthCore.framework/AWSAuthCore'

	/private/var/containers/Bundle/Application/5A196EC7-9148-4370-81BA-4EB518987940/AWSKinesisVideoWebRTCDemoApp.app/Frameworks/AWSAuthCore.framework/AWSAuthCore: stat() failed with errno=1

Some other libraries have the same problem (dyld: Library not loaded error on real devices with iOS 13.3.1 using non-paid developer account).

I just modified Podfile to remove use_frameworks! and add use_modular_headers! according to the issues above, but got another error.

ld: framework not found AWSCognitoIdentityProvider
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The issues above say this problem will be fixed on iOS 13.4 beta 3, I will try it later.
If you have any workaround for this problem, please let me know. Thank you.

LTE to WIFI connection not working

I started live stream with WIFI and i turned off my WIFI and opened LTE. Live stream was frozen. When i turn on WIFI again, everything is good.

Handle caching of ICE candidates

Because of out of order signaling message delivery, it is possible that the ICE candidates arrive before the answer in trickle ICE mode and the SDK does not track these ICE candidates. In the sample, we need to implement a caching logic to store any ICE candidates that are received before getting an answer to ensure we do not lose these while creating candidate pairs. The WebRTC C SDK handles this, but other SDKs do not.

Getting payload error where more than one viewer view the live stream

Hi, We are using Kinesis Video stream for the live video streaming also have done setup for the ios application as well as backend, But while running the same we cant able to see if number of viewer increase from one. Also we have tried to run viewer one from the application and other from the AWS console and also from the multiple ios devices but still we are getting the error.

We are getting this error.
"Additional signaling messages "
Event =
payload Error Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.}

Please provide a solution for the same as we require some simple and perfect solution for the live video streaming for our IOS application.

Thanks & Regard
Gaurav Kumar

Sign In Crashes

Hi AWSLABS Team,

I have been implementing WebRTC app using this sdk but when I test sample I get crash if I try to Sign In.

In screenshot below user is nil.

Let me know if I am doing something wrong! Thank you!

Screen Shot 2021-04-13 at 7 04 35 PM

Cannot log in

Removed for security concern

Is there any problem with my setting?
why does app crash when signin in AWSMobileClientExtensions.swift.
self.userPoolClient is still nil, so created user is nil.

Invalid HTTP upgrade, code: 403

Hello I am getting following error while SignalingClient trying to connect

What I am missing in setup server?

Connecting to web socket from channel config
"Disconnected from signaling. WSError(type: Starscream.ErrorType.upgradeError, message: "Invalid HTTP upgrade", code: 403)"

Thanks

iOS app not able to show the streaming from another device

Hi,

I am tying to develop my own iOS as per the code given in this project and I have observed the following behaviour in my app.

  1. I tried running my iOS app in iPhone 6 simulator (OS version 12.1) and I could see the Live streaming successfully and able to hear the voice.

  2. I tried running my iOS app in iPhone 6 physical device (OS version 12.4.6) and I could see the Live streaming successfully and able to hear the voice.

  3. I am not able to see the Live streaming in iPhone11 simulator (OS version greater than 13) but I can hear the voice.

  4. I am not able to see the Live streaming in iPhone 6 physical device (OS version greater than 13) but I can hear the voice.

============== Code snippet to create Live stream video view =============
func embedVideoView(){
#if arch(arm64)
// Using metal (arm64 only)
let remoteRenderer = RTCMTLVideoView(frame: liveVideoView.frame)
remoteRenderer.videoContentMode = .scaleAspectFill

    #else
    let remoteRenderer = RTCEAGLVideoView(frame: liveVideoView.frame)
    #endif
    
    self.webRTCClient.renderRemoteVideo(to: remoteRenderer)
    
   embedView(remoteRenderer, into:liveVideoView )
}

private func embedView(_ view: UIView, into containerView: UIView) {
    containerView.addSubview(view)
    view.translatesAutoresizingMaskIntoConstraints = false
    containerView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[view]|",
                                                                options: [],
                                                                metrics: nil,
                                                                views: ["view": view]))
    
    containerView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[view]|",
                                                                options: [],
                                                                metrics: nil,
                                                                views: ["view": view]))
    containerView.layoutIfNeeded()
}

====================== End of Code ===================================

Please help.

WSError(type: Starscream.ErrorType.upgradeError, message: \"Invalid HTTP upgrade\", code: 400)

Hi everyone!
I'm writing an app using AWS WebRTC SDK for iOS and facing an issue about signing:
"Disconnected from signaling. WSError(type: Starscream.ErrorType.upgradeError, message: "Invalid HTTP upgrade", code: 400)"
My project has credential, channel ARN and HTTP(WSS) endpoint are got from Backend.
I'm using Starscream (3.1.1)
This is my WSS URL that I used to init SignalingClient

image
Please help me a solution!

the demo cannot work between Embedded SDK master and iOS device

Hi all,

this demo built P2P Streaming between two iOS devices successfully, but it failed between Embedded SDK master and iOS device, I integrated the Embedded SDK into IP camera. By the iOS log, it looks like the candidate cannot be received from the camera, and from the camera log, it looks like the IceAgent failed. please kindly advise this, or could you please add a specific iOS demo to adapt Embedded SDK master

020-12-30 10:34:15 DEBUG turnConnectionHandleStun(): Channel bind succeeded with peer 18.218.208.89, port: 51954, channel number 16389
2020-12-30 10:34:15 DEBUG turnConnectionHandleStun(): Channel bind succeeded with peer 18.218.208.89, port: 60904, channel number 16390
2020-12-30 10:34:15 DEBUG turnConnectionHandleStun(): Channel bind succeeded with peer 18.218.208.89, port: 53673, channel number 16391
2020-12-30 10:34:15 DEBUG turnConnectionHandleStun(): Channel bind succeeded with peer 3.129.59.42, port: 65476, channel number 16392
2020-12-30 10:34:15 DEBUG turnConnectionHandleStun(): Channel bind succeeded with peer 3.129.59.42, port: 54198, channel number 16393
2020-12-30 10:34:15 DEBUG lwsWssCallbackRoutine(): Client receive
2020-12-30 10:34:16 DEBUG turnConnectionStepState(): TurnConnection state changed from TURN_STATE_CREATE_PERMISSION to TURN_STATE_BIND_CHANNEL
2020-12-30 10:34:16 DEBUG turnConnectionStepState(): TurnConnection state changed from TURN_STATE_CREATE_PERMISSION to TURN_STATE_BIND_CHANNEL
2020-12-30 10:34:19 DEBUG sessionCleanupWait(): >>>Number of sessions 1
2020-12-30 10:34:19 DEBUG sessionCleanupWait(): ---session [0] peerid : a3706a23-40b7-4319-afeb-2462ae3870a2
2020-12-30 10:34:19 DEBUG turnConnectionStepState(): TurnConnection state changed from TURN_STATE_BIND_CHANNEL to TURN_STATE_READY
2020-12-30 10:34:19 DEBUG turnConnectionStepState(): TurnConnection state changed from TURN_STATE_BIND_CHANNEL to TURN_STATE_READY
2020-12-30 10:34:24 DEBUG lwsWssCallbackRoutine(): Client is writable
2020-12-30 10:34:24 DEBUG sessionCleanupWait(): >>>Number of sessions 1
2020-12-30 10:34:24 DEBUG sessionCleanupWait(): ---session [0] peerid : a3706a23-40b7-4319-afeb-2462ae3870a2
2020-12-30 10:34:29 DEBUG sessionCleanupWait(): >>>Number of sessions 1
2020-12-30 10:34:29 DEBUG sessionCleanupWait(): ---session [0] peerid : a3706a23-40b7-4319-afeb-2462ae3870a2
2020-12-30 10:34:33 DEBUG stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000040
2020-12-30 10:34:33 ERROR executeFailedIceAgentState(): IceAgent failed with 0x5a00000d
2020-12-30 10:34:33 DEBUG stepIceAgentStateMachine(): Ice agent state changed from ICE_AGENT_STATE_CHECK_CONNECTION to ICE_AGENT_STATE_FAILED.
2020-12-30 10:34:33 INFO onConnectionStateChange(): New connection state 5
2020-12-30 10:34:33 DEBUG sessionCleanupWait(): >>>Number of sessions 1
2020-12-30 10:34:33 DEBUG sessionCleanupWait(): ---session [0] peerid : a3706a23-40b7-4319-afeb-2462ae3870a2
2020-12-30 10:34:33 DEBUG freeSampleStreamingSession(): Freeing streaming session with peer id: a3706a23-40b7-4319-afeb-2462ae3870a2
2020-12-30 10:34:33 DEBUG socketConnectionClosed(): Close socket 33
2020-12-30 10:34:33 DEBUG socketConnectionClosed(): Close socket 32
2020-12-30 10:34:33 DEBUG socketConnectionClosed(): Close socket 31
2020-12-30 10:34:33 DEBUG turnConnectionStepState(): TurnConnection state changed from TURN_STATE_READY to TURN_STATE_CLEAN_UP
2020-12-30 10:34:33 DEBUG turnConnectionStepState(): TurnConnection state changed from TURN_STATE_READY to TURN_STATE_CLEAN_UP
2020-12-30 10:34:34 WARN iceAgentShutdown(): TurnConnection shutdown did not complete within 1 seconds
2020-12-30 10:34:34 DEBUG socketConnectionClosed(): Close socket 35
2020-12-30 10:34:34 DEBUG socketConnectionClosed(): Close socket 34
2020-12-30 10:34:35 DEBUG lwsWssCallbackRoutine(): Client is writable
2020-12-30 10:34:35 DEBUG genCerts(): >>>>>>>>>>>>>>>>> start generating certs
2020-12-30 10:34:35 DEBUG genCerts(): >>>>>>>>>>>>>>>>> completed generating certs
2020-12-30 10:34:40 DEBUG sessionCleanupWait(): >>>Number of sessions 0
2020-12-30 10:34:45 DEBUG lwsWssCallbackRoutine(): Client is writable
2020-12-30 10:34:45 DEBUG sessionCleanupWait(): >>>Number of sessions 0

thanks

WebRTC connection failing at times for prolonged duration of time.

Hello,
We have reused classes from this project like WebRTCClient to connect to a Wifi camera using WebRTC. The app is currently in Beta and we received couple of reports of connectivity failure. Our observation so far:

  • One of our Beta user is not able to connect to the camera using his iPhone 12(iOS 14.6) and iPhone XR(iOS 14.6). He has tried connecting using Vodafone Idea 4G, Jio 4G, Airtel 4G, Jio Fiber. None have worked for him. Very rarely sometimes, he is able to get access. Our support engineers, were able to access his camera using his login without any problems. One difference we noticed is that both his phones had dual SIM, one physical SIM and one e-SIM. We gave the Beta user, a release of this AWS test app and when connected as a viewer, the master feed was blank(white) for him. This was to confirm that no issue was introduced by our additional layers of code.
  • One of our developers started facing the same issue after his Wifi router was changed to one that supports both 2.5Ghz and 5Ghz. The router was setup to have an AP for each respectively, 2.5Ghz & 5Ghz. The mobile device when connected to 2.5Ghz alone ( with 4G disabled) gave the following behaviour:
  1. Connect Signalling client - Success
  2. Send SDP Offer - Success
  3. Send ICE Candidates - Success
  4. Receive SDP Answer - Success
  5. Peer Connection Established - Success
  6. WebRTC state changed to Failed after around on an average 18 seconds
    The behaviour was the same with this AWS Test App also. However, the WebRTC connected when the mobile device is connected to 4G(with Wifi disabled) or Wifi (with both Wifi & 4G enabled). The device used is iPhone XR and iOS 14.6.
    Surprisingly, since this morning with the same setup, the webRTC is getting connected for the developer. The situation is still the same for the Beta user with no connection.
  • The behaviour is the same with disableIPv6 set to true & false. By default it is false.

We understand that there are many moving parts here and the point of failure could be any. We are looking for pointers, clues & possible resolution from your team to support us to go live.

Thanks in advance!

Git issue - pathspec 'Swift/Pods/AWSCore/AWSCore/Service/AWSService.m' did not match any file(s) known to git

This could be a documentation issue or maybe I am doing something wrong on my part. I have followed the steps outlined in this documentation exactly:
https://docs.aws.amazon.com/kinesisvideostreams-webrtc-dg/latest/devguide/kvswebrtc-sdk-ios.html

Here is where I am stuck

Screenshot 2021-04-03 at 20 18 12

This is the message i am getting on terminal

Screenshot 2021-04-03 at 20 18 41

Is the documentation outdated or am I doing something wrong? I cloned the project, cleared pods cache rebuilt it and did everything as instructed but this one step fails. New to version control so any help would be appreciated. Thank you!

[NSURLComponents setPercentEncodedQueryItems:]: invalid characters in percentEncodedQueryItems.

I am trying to stream videos to Aws Kinesis.
So when I click on Connect as master after specifying channel-name and region. I am getting this NSInvalidArgumentException.

Here is the full log:

2021-06-12 16:16:14.409353+0545 AWSKinesisVideoWebRTCDemoApp[3438:1218641] Warning: A long-running operation is being executed on the main thread. Break on awsbf_warnBlockingOperationOnMainThread() to debug. 2021-06-12 16:16:14.451666+0545 AWSKinesisVideoWebRTCDemoApp[3438:1218919] [Client] Updating selectors after delegate removal failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 87 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service on pid 87 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.} 2021-06-12 16:16:16.205182+0545 AWSKinesisVideoWebRTCDemoApp[3438:1218927] [connection] nw_endpoint_handler_set_adaptive_read_handler [C1.2.1 2600:1f18:257:8000:2af5:2c1c:12c4:d6eb.443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, scoped, ipv4, ipv6, dns)] unregister notification for read_timeout failed 2021-06-12 16:16:16.206102+0545 AWSKinesisVideoWebRTCDemoApp[3438:1218927] [connection] nw_endpoint_handler_set_adaptive_write_handler [C1.2.1 2600:1f18:257:8000:2af5:2c1c:12c4:d6eb.443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, scoped, ipv4, ipv6, dns)] unregister notification for write_timeout failed 2021-06-12 16:16:16.213796+0545 AWSKinesisVideoWebRTCDemoApp[3438:1218927] [tcp] tcp_output [C1.1.1:3] flags=[R.] seq=59726133, ack=2906294661, win=4092 state=CLOSED rcv_nxt=2906294661, snd_una=59726133 2021-06-12 16:16:17.720310+0545 AWSKinesisVideoWebRTCDemoApp[3438:1218919] [connection] nw_endpoint_handler_set_adaptive_read_handler [C2.2.1 2600:1f18:41d6:7400:5df4:7b6a:9118:cf7.443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, scoped, ipv4, ipv6, dns)] unregister notification for read_timeout failed 2021-06-12 16:16:17.720402+0545 AWSKinesisVideoWebRTCDemoApp[3438:1218919] [connection] nw_endpoint_handler_set_adaptive_write_handler [C2.2.1 2600:1f18:41d6:7400:5df4:7b6a:9118:cf7.443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, scoped, ipv4, ipv6, dns)] unregister notification for write_timeout failed 2021-06-12 16:16:19.605190+0545 AWSKinesisVideoWebRTCDemoApp[3438:1219028] [connection] nw_endpoint_handler_set_adaptive_read_handler [C3.2.1 34.236.195.233:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, scoped, ipv4, ipv6, dns)] unregister notification for read_timeout failed 2021-06-12 16:16:19.605516+0545 AWSKinesisVideoWebRTCDemoApp[3438:1219028] [connection] nw_endpoint_handler_set_adaptive_write_handler [C3.2.1 34.236.195.233:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, scoped, ipv4, ipv6, dns)] unregister notification for write_timeout failed Channel ARN : arn:aws:kinesisvideo:us-east-1:121659873158:channel/demo-channel/1623488241027 2021-06-12 16:16:19.979061+0545 AWSKinesisVideoWebRTCDemoApp[3438:1218641] Warning: A long-running operation is being executed on the main thread. Break on awsbf_warnBlockingOperationOnMainThread() to debug. Resource Endpoint List : [<AWSKinesisVideoResourceEndpointListItem: 0x2815f4780> { protocols = 2; resourceEndpoint = "https://r-72f8248f.kinesisvideo.us-east-1.amazonaws.com"; }, <AWSKinesisVideoResourceEndpointListItem: 0x2815f4740> { protocols = 1; resourceEndpoint = "wss://m-07e4d66a.kinesisvideo.us-east-1.amazonaws.com"; }] 2021-06-12 16:18:12.257351+0545 AWSKinesisVideoWebRTCDemoApp[3438:1219015] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSURLComponents setPercentEncodedQueryItems:]: invalid characters in percentEncodedQueryItems' *** First throw call stack: (0x18f4e3298 0x1a323d480 0x19081916c 0x192df2910 0x192dee220 0x102bc85bc 0x102bcafe4 0x102bc99e4 0x102bbe214 0x102bbf4f0 0x102bbf54c 0x103376a88 0x10332b66c 0x10332be8c 0x103376e20 0x103376510 0x103375ec8 0x103377c00 0x10338e408 0x103377258 0x103376a88 0x10332b66c 0x10332be8c 0x103376968 0x103377170 0x10337730c 0x10338c588 0x18fc894c8 0x103d23ae8 0x103d2532c 0x103d2c38c 0x103d2d044 0x103d38820 0x1d7a095bc 0x1d7a0c86c) libc++abi: terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSURLComponents setPercentEncodedQueryItems:]: invalid characters in percentEncodedQueryItems' terminating with uncaught exception of type NSException

Using XCode 12.5 running on Big Sur.

WebRTC Framework with bitcode enabled size

Hello,

We have a following issue:

we were going through your WebRTC + iOS SDK documentation and included all the pods from the sample in our project, but GoogleWebRTC dependency provides framework without bitcode enabled.

After following those instructions https://webrtc.github.io/webrtc-org/native-code/ios/ we were able to create a WebRTC.framework with bitcode enabled, the issue is, that even after stripping not needed architectures this framework is ~650mb

This create a problem because our application size after including this framework is almost 800mb, that's way too much.

Is there another way to configure webrtc + kvs that's not described in the documentation to avoid this?

Additional info:

  • our application is built as a modular application - reference
  • we're using AWSBasicAuthorizationCredentials instead of AWSCognito (not sure if that matters in this case)

How to support the H264 which the profile-level-id is 42e01f

Hi,

because the target embedded camera only support H264 which the profile-level-id is 42e01f, iOS app also want to support this kind of H264, but from the iOS WebRTC SDK, it only support H264 which profile-level-id are 640c2a and 42e02a. it will lead the video cannot be decoded successfully. I also try to customize the profile-level-id with 42e01f and forbid other profile-level-id, however, the video cannot be rendered any more. Could you please point out how to support this kind of H264 format? appreciate for help.

thanks

Acces denied with a Cognito guest user

I try to make this work with a Cognito guest user (I have enabled this in the identity pool and added kinesis to the IAM roles). I use the following code to 'log in'.

let credentialsProvider = AWSCognitoCredentialsProvider(regionType:.USEast1,
           identityPoolId:"my-pool-id")
let configuration = AWSServiceConfiguration(region:.USEast1, credentialsProvider:credentialsProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
AWSKinesisVideo.register(with: configuration!, forKey: awsKinesisVideoKey)

But when I try to run the following function it gives me the accesdeniedexception:

func createChannel(channelName: String) {
        let kvsClient = AWSKinesisVideo.default();
        let createSigalingChannelInput = AWSKinesisVideoCreateSignalingChannelInput.init()
        createSigalingChannelInput?.channelName = channelName
        kvsClient.createSignalingChannel(createSigalingChannelInput!).continueWith(block: { (task) -> Void in
            if let error = task.error {
                print("Error creating channel \(error)")
                return
            } else {
                self.channelARN = task.result?.channelARN
                print("Channel ARN : ", task.result?.channelARN)
            }
        }).waitUntilFinished()
        if (self.channelARN == nil) {
            let alertController = UIAlertController(title: "Unable to create channel",
                                                    message: "Please validate all the input fields",
                                                    preferredStyle: .alert)
            let okAction = UIAlertAction(title: "Ok", style: .default, handler: nil)
            alertController.addAction(okAction)

            self.present(alertController, animated: true, completion: nil)
            return
        }
    }

What is wrong here? Or how can I make it work?

WebRTC Crash dSYM

We did follow the documented steps to get WebRTC and include it in our Kinesis based App, similar to the Sample App.

We did not see any issues during development but as usual in production our crash tool (BugSnag) started to report events from WebRTC, they are not symbolized because we do not have the dSYM file.

Any steps to get the dSYM file so I can upload it to BugSnag to see the stack from WebRTC crashes?

Sign up (ContinueWith Block) not being executed

I have built and ran the project on a real device successfully. I also followed the steps on creating an amazon cognito identity and user pools and pasted the values. What happens is, when I provide a username, password and userAttributes to the sign up method on self.pool, the "continueWith" block just doesn't execute. No crashes and no further execution. Any directions from here on?

I can't log in from Tokyo

Hello, we confirmed a sample of the SDK. I'm told I'm logged in during signup, but I can't log in. Is there a solution?

Error to get channel endpoint: Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=8 "(null)"

Hi all,

I have followed the step, suggested on page WebRTC SDK for iOS. I have configured Cognito userpool and Cognito IdentiyPool as follows:

  1. "Enable access to unauthenticated identities" is checked under "Unauthenticated identities" in Identity Pool setting.
  2. Edited the Trust Relationship for unauth role in IAM to and retry (suggested here )
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Federated": "cognito-identity.amazonaws.com"
      },
      "Action": "sts:AssumeRoleWithWebIdentity"
    }
  ]
}

However, I am getting the following error

Error to get channel endpoint: Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=8 "(null)" UserInfo={__type=NotAuthorizedException, message=Identity pool - us-east-1:XXXX-XXX-XXX-XXX-XXXXX does not have identity providers configured.

WebRTC does not connect if there is no forced delay between Signaling Client connect and sendOffer

`signalingClient!.connect()

    let seconds = 2.0
    DispatchQueue.main.asyncAfter(deadline: .now() + seconds) {
        self.updateConnectionLabel()
        self.vc = VideoViewController(webRTCClient: self.webRTCClient!, signalingClient: self.signalingClient!, localSenderClientID: self.localSenderId, isMaster: self.isMaster!)
        self.present(self.vc!, animated: true, completion: nil)
    }`

As you see in the above snippet there is a delay of 2 seconds after the connect method is executed and before the sendOffer is executed inside VideoViewController init method.
If this is set to 0, the WebRTC does not get connected and for values between 0 & 2 it is very inconsistent. Even with 2, one or two out of ten times it does not get connected.

  • This file has the log when the forced delay was set to 0 seconds. WebRTC does not connect with this. It tries to connect for a minute after which, the connection is closed by a timer in the application.
  • This file has the log when forced delay was set to 2 seconds. WebRTC connects successfully.

What is the significance of this delay and how could this be made more consistent? This is not something specific to an individual network because these findings are from beta testing with an audience of 30+ people.

Thanks in advance.

No such module 'AWS CognitoIdentityProvider'

Swift Compiler Error message: No such module 'AWS CognitoIdentityProvider'

Hi, I want to try the Kinesis Video Stream sample for ios. when I try to build the app, I got this error. I have been removed Pods dir and rerun pod install multiple times and still get the same error. I really appreciate any help. Thank you

System Info:
Xcode version: 12.0.1
pod version: 1.9.3

Error when I run a project

no such module 'awscognitoidentityprovider'
Hi, I want to try the Kinesis Video Stream sample for ios. when I try to build the app, I got this error. I have been removed Pods dir and rerun pod install multiple times or recreate project still get the same error. I really appreciate any help. Thank you
caf65e94fdfd286597617b2b8846021
This is my pod file list
582862da195147b011500b08fa73198

WebRTC-iOS to Amazon S3

Sorry for posting this query as issue. But I would like to know is it possible to store WebRTC-iOS streamed video in S3.
If yes could you kindly provide guidance regarding the same.

How to record remote audio to a file?

Hello,
The use case is to record the remote video & audio to a single file. I am able to successfully record the video by

  • By overriding the renderFrame method in RTCVideoRenderer, I get access to every RTCVideoFrame.

  • If recording has started, every RTCVideoFrame is converted to CMSampleBuffer and appended to the VideoInput of the AVAssetWriter

This works perfectly fine. I have checked throughout but cannot find a way to hook the remote audio to the AudioInput of the AVAssetWriter. There is no delegate present in the RTCAudioSource or RTCAudioTrack.
Please guide what is the right way to do it as it is a very common use case and other applications with WebRTC are doing it.

Thanks in advance!

Starscream Error: Invalid HTTP upgrade

Hi!

I downloaded this demo, but when I run in simulator and device, I get this message in console:

Starscream 3.0:
WSError(type: Starscream.ErrorType.upgradeError, message: "Invalid HTTP upgrade", code: 403)

Starscream >=4.0:
Starscream.HTTPUpgradeError.notAnUpgrade(403)

What's wrong?

Help me, please!!

Thanks for all!

Fatal error: Unexpectedly found nil

Hi:

I am building the sample app and have gone through all instructions provided in the github. I am getting to the login page but it seems I encounter the error below; I've done this with a pre-populated user in my user group in addition to a confirmed new user through the app. It crashes when I use the tap the Sign In button. Please advise; I am hoping to leverage kinesis to stream video iOS devices.

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file AWSMobileClient/AWSMobileClientExtensions.swift, line 226
2020-12-07 22:33:43.768920-0800 AWSKinesisVideoWebRTCDemoApp[588:182775] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file AWSMobileClient/AWSMobileClientExtensions.swift, line 226

Piece of code where it fails:

user!.getSession(username,      // Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value 
     password: password,
     validationData: validationAttributes,
     clientMetaData: clientMetaData,
     isInitialCustomChallenge: isCustomAuth).continueWith { (task) -> Any? in

Speaker Issue

Hello. I cannot use in speaker mode. I added do-catch block for catch error. I used demo app.

do {
    try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
}catch {
    print("error ", error.localizedDescription)
}

The operation couldn’t be completed. (OSStatus error -50.)

Does this work for unauth users?

Was wondering, all tutorials and documentation have pointed to users being authenticated using AWS cognito in order to access kinesis. Does this work for unauth users using just identity pools?

the video received from embedded camera cannot be rendered

Hi,

I tried to run sample with P2P Streaming between Embedded SDK master and iOS device. Form the log of camera and mobile app, the video data has been returned from the camera, but it cannot be rendered in the mobile app side. And we also refer to the Web KVSWebRTC SDK sample and the video can be rendered successfully. We analyzed the offer sent to camera and answer received from camera, and found codec type might be not matched. The attachments are the logs of offer and answer, please kindly advise how to fix this codec issue.

  • In the camera side, the supported codec type is H264, so mobile app and web need send H264 type to camera in the offer.
  • From the iOS log, the sent offer includes the H264, but the profile-level-id is different from one in the Camera, profile-level-id is 640c2a and 42e02a in the app, but profile-level-id is 42e01f in the camera. I also tried to create the customized encoder/decoder to change the profile-level-id with 42e01f in the app, but it still failed to render video.
  • From the web log, the sent offer includes the H264, and profile-level-id is 42e01f in both web and camera.
  • attached list:
    iOS_offer.txt: the offer sent to the embedded camera**(not change the profile-level-id)**
    iOS_answer.txt: the answer received to the embedded camera**(not change the profile-level-id)**
    web_offer.txt: the offer sent to the embedded camera
    web_answer.txt the answer received to the embedded camera
    iOS_P2P_log.txt: the log got the video from the embedded camera(changed the profile-level-id)

iOS_P2P_log.txt
web_answer.txt
web_offer.txt
iOS_answer.txt
iOS_offer.txt

High latency observed while establishing WebRTC connection

On an average, it is observed that the connection takes ~4 seconds to get established and majority of that time is used in ICE Candidate negotiation.
Screenshot 2021-03-16 at 4 31 19 PM

  • Region: ap-south-1
  • Channel name: G00201PS000002

I took a sample of 20 for both Wifi and 4G connection. The results are compiled here:
WebRTCTestRuns.xlsx

We have 5 internal testers using the app on a daily basis switching between wifi and 4G; also at various times of the day. The general consensus is that it takes between 4 to 5 seconds to connect in iOS and 2 to 3 seconds to connect in Android which prompted me to get the time elapsed at each step for iOS. We will be also be putting in logs to capture the elapsed time for each step in Android in couple of days for comparison.

Error describing channel

Hi there:
I use this sdk to build ios app but I get "Error describing channel" many times. I don't know what's wrong,anyone can help,may thanks!
Here is my code:

func retrieveChannelARN(channelName: String) {
print("retrive channel ARN",channelName)
if !channelName.isEmpty {
let describeInput = AWSKinesisVideoDescribeSignalingChannelInput()
describeInput?.channelName = channelName
let kvsClient = AWSKinesisVideo(forKey: awsKinesisVideoKey)
kvsClient.describeSignalingChannel(describeInput!).continueWith(block: { (task) -> Void in
if let error = task.error {
print("Error describing channel: (error)")
} else {
self.channelARN = task.result?.channelInfo?.channelARN
print("Channel ARN : ", task.result!.channelInfo!.channelARN ?? "Channel ARN empty.")
}
})//.waitUntilFinished()
// remove waitUntilFinished to set time out
} else {
return
}
}

Here is error: (if I met once,I will always get this error for several minutes.If I met once,I tried to get several different channel ARN,they were all fail)
Error describing channel: Error Domain=com.amazonaws.AWSNetworkingErrorDomain Code=2 "URLSession is nil or invalidated" UserInfo={NSLocalizedDescription=URLSession is nil or invalidated}

Login crash

When I provide the login details, the app crashes with the following:

2020-04-10 14:52:20.672600-0700 AWSKinesisVideoWebRTCDemoApp[2701:599931] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /Tests/kinesis/amazon-kinesis-video-streams-webrtc-sdk-ios/Swift/Pods/AWSMobileClient/AWSAuthSDK/Sources/AWSMobileClient/AWSMobileClientExtensions.swift, line 211

validationAttributes when calling - (AWSTask<AWSCognitoIdentityUserSession *> *)getSession
(NSString *)username
password:(NSString *)password
validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData
isInitialCustomChallenge:(BOOL)isInitialCustomChallenge is nil.

Is there any example about using data channel?

Hi, I'm writing an app using Kinesis video streaming in iOS.
This SDK sample seems don't have sample using data channel. But I confirmed that Android SDK has sample for it.
Perhaps, I haven't found the sample. So, do you have any sample for using data channel like Android?

How to send customize message?

I want to let master send message to viewers, how to do it? What is the 'action' of customize message? I cannot find any document about it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.