Quick start
TikCDN solution makes full use of idle terminal bandwidth resources, complements traditional CDN, and builds a cost-effective new generation of content distribution network. Developers can quickly integrate with their own applications through the simple interface in the SDK to achieve P2P acceleration on iOS devices.
Precondition
- Xcode 13.0 or later (This article uses Xcode 13.0 as an example)
- Devices with iOS 13.0 or later
- Effective account TikCDN developers
Demo Running Guide
2、Configuration develops information
KeyCenter.swift
Find the AppId in the above file
static let AppId: String = <#YOUR APPID#>
3、Change the Bundle Identifier to ensure that it is the same as the value entered when the application was created, otherwise the accelerator service will not be used.
4、After running through, you need to run through the example on another machine to see the P2P acceleration effect.
Integrated SDK
Integration through CocoaPods
platform :ios, '13.0'
target 'LiveiOSDemo' do
use_frameworks!
pod 'X2TikTracker',
end
Manual integration
1、Copy X2TikTracker.framework to the project directory.
2、 Xode -> General -> "Framework, Libraries, and Embedded Content" Add X2TikTracker.framework。
Implementation step
Initialization engine
engineKit = X2TiktrackerKit.init(delegate: self, appId: KeyCenter.AppId)
Start playing and speed up
engineKit.startPlay(playUrl, share: true)
Get the p2p acceleration URL
let url = engineKit.getExPlayUrl()
Playback acceleration URL
player = AVPlayer(url: url! as URL)
Stop accelerating
engineKit.stopShare()
Release engine
engineKit.release(true)