Skip to main content

API Doc

Method

initWithDelegate

Creates and initializes X2TiktrackerKit

- (instancetype)initWithDelegate:(id<X2TikTrackerDelegate>)delegate appId:(NSString *)appId;

Parameters

ParameterDescription
delegateX2TikTrackerDelegate Callback
appIdDeveloper information

Return Value

The X2TiktrackerKit instance

release

Release engine

- (int)release:(BOOL)sync;

Parameters

ParameterDescription
syncWhether to release resources synchronously
  • Return Value

0:scuess,>0:failed

startPlay

Start playing

- (int)startPlay:(NSString *)strUrl share:(BOOL)bShare;
tip

The system starts to play a video at a specified address and select whether to enable P2P sharing.

Parameters

ParameterDescription
strUrlThe URL that is actually played.
bShareWhether to enable P2P sharing

Return Value

0:scuess,>0:failed

stopPlay

Stop playing

- (int)stopPlay;

Return Value

0:scuess,>0:failed

getExPlayUrl

Get the p2p URL acceleration address

- (NSString *)getExPlayUrl;

Return Value

Accelerated playback link

startShare

开始P2P共享

- (int)startShare;

Return Value

0:scuess,>0:failed

stopShare

Start P2P sharing

- (int)stopShare;

Return Value

0:scuess,>0:failed。

setParameters

Method for setting private parameters

- (int)setParameters:(NSString *)strParam;

Parameters

ParameterDescription
strParamParameter string (json string)

Return Value

0:scuess,>0:failed

setConfig

Setting configuration method

- (int)setConfig:(X2TikKitConfig *)x2Config;

Parameters

ParameterDescription
x2ConfigX2TikTConfig Configuration object

Return Value

0:scuess,>0:failed

Callback interface

X2TikTrackerDelegate

Callback interface for receiving play and share events:

- (void)onShareResult:(X2TKTCode)nCode;  // P2P sharing results.
- (void)onLoadDataStats:(X2TikDataStats *)jsStats; // Data statistics callback.
- (void)onPeerOn:(NSString *)strPeerUId peerData:(NSString *)strPeerUData; //This callback is triggered when a new P2P node successfully joins the network. In this case, there will be new devices or users in the P2P network to share data or resources.
- (void)onPeerOff:(NSString *)strPeerUId peerData:(NSString *)strPeerUData; // When a P2P node or user is disconnected from the network.