Table of Contents |
---|
Resources
Download |
---|
...
http://flashphoner.com/downloads/builds/flashphoner_client/wcs-ios-sdk
API documentation for iOS SDK
http://flashphoner.com/docs/api/WCS5/client/ios-sdk/latest
Download the source code of the examples for iOS SDK
...
The source code of the examples is located at Github and is used to comment the examples in the present
documentation. For example, this link line 78 points to the seventy eighth line in the ViewController.m file of the Media Devices example
the revision with the hash of 79a318b6.
Preparing examples for building
0. Install Cocoapods to build dependencies.
Code Block | ||||
---|---|---|---|---|
| ||||
sudo gem install cocoapods |
1. Download the source code of the examples for Mac.
Code Block | ||||
---|---|---|---|---|
| ||||
git clone https://github.com/flashphoner/wcs-ios-sdk-samples.git |
2. Download the iOS SDK
Code Block | ||||
---|---|---|---|---|
| ||||
wget http://flashphoner.com/downloads/builds/flashphoner_client/wcs-ios-sdk/WCS-iOS-SDK-2.2.2.tar.gz |
3. After unpacking, the iOS SDK is a framework in the FPWCSApi2.framework folder
Code Block | ||||
---|---|---|---|---|
| ||||
tar -xvzf WCS-iOS-SDK-2.2.2.tar.gz |
4. Copy the unpacked iOS SDK (framework) to the sample folder
Code Block | ||||
---|---|---|---|---|
| ||||
cp -R FPWCSApi2.framework wcs-ios-sdk-samples |
5. As a result, we have got the sample folder with the framework (iOS SDK). Now we can start building.
6. Run the build script and wait while all dependencies and examples are built
Code Block | ||||
---|---|---|---|---|
| ||||
./build_example.sh |
7. Now, as soon as all dependencies are ready (thanks, cocoapods), open workspace in Xcode.
Important! You should open the workspace, not the project file. Otherwise, the build may be broken.
...
To do this, click WCSExample in the left menu. After specifying the Team, build the examples again using the script as shown on the step 6.
9. Now, we build the Media Devices example in Xcode. To do this, select Generic iOS Device in the build targets.
10. Run the build from the Product – Build menu
11. If the build successfully completes, you should see the Build MediaDevices message:Succeeded
12. Connect your iPhone or iPad via the USB and select it in the targets to run the Media Devices example
13. After successful run, the debug information is displayed in the lower part. This means, the Media Devices example has been correctly installed to iPhone or iPad and is running.
14. On iPhone, you should see the interface of the application you can start testing using the WCS server
15. Connect to the server and send a video stream from the web camera to the iPhone.
16. In Xcode logs we can see the debug information.
...
iOS SDK builds differences
1. iOS SDK 2.6, since build 2.6.19, includes two frameworks: Objective C and Swift, and since 2.6.95 Objective C framework is shipped as XCFramework.
2. Due to WebRTC library update, iOS SDK builds since 2.6.86 will work only on arm64 hardware (iPhone 5s and newer).
3. Version 2.5 examples cannot be build with version 2.6 due to changes in video capturing to allow custom video capturer implementation. Links in the table above point to compatible source code for each SDK version.
Examples building
Here is described how to build examples using Xcode before 10. Examples building procedure with Xcode 10 and newer slightly differs, and described here. Since iOS SDK build 2.6.114, examples may be built with SPM packages, the procedure is describedhere.
Known issues
1. To play WebRTC stream correctly in iOS application in fullscreen mode it is necessary to follow client device aspect ratio
Symptoms: when stream is published with aspect ratio 4:3 (640x480 for example), video looks stretched in iOS application in fullscreen mode.
Solution: stream should be published with aspect ratio 16:9 (1280X720 for example)
2. Build 2.6.37 is compatible only with WCS builds since 5.2.935
Symptoms: streaming works in example application, but buttons state and status messages remain unchanged, there can be messages in application logs like
Code Block | ||
---|---|---|
| ||
Error converting audioState JSON to FPWCSApi2MediaState
Error converting videoState JSON to FPWCSApi2MediaState |
Solution: update WCS build to 5.2.935 or newer
3. It is recommended to use Rosetta when building applications in Xcode for iOS Simulator on Mac with M1 CPU.