Integration

Copy the framework

Unzip files, then drag and drop SwarmCloudSDK.xcframework and WebRTC.xcframework into your Xcode project on your application targets’ General settings tab, in the Frameworks, Libraries, and Embedded Content section.

https://ecocdn.net/ios_sdk/SwarmCloudSDK.xcframework.zip
https://ecocdn.net/ios_sdk/WebRTC.xcframework.zip

In order to allow the loading of distributed content via the local proxy, enable loading data from HTTP in your app by opening your info.plist file as source code and adding the following values below the tag:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Import SwarmCloudSDK in AppDelegate.m:

swift

import SwarmCloudSDK

objective-c

#import <SwarmCloudSDK/SwarmCloudSDK.h>

Initialize SWCP2pEngine

Initialize SWCP2pEngine in AppDelegate.m:

swift

objective-c

Where YOUR_TOKEN is your Customer ID.

Usage

When initializing an AVPlayer (or any other video player) instance, before passing it a URL, pass that URL through P2P Engine:

swift

objective-c

That’s it! SDK should now be integrated into your app.

Last updated

Was this helpful?