配置查看 License

最近更新时间:2026-04-20 17:34:05

我的收藏

配置方法

调用 SDK 的相关接口前,您需要调用如下方法配置 License:
iOS 建议在 [AppDelegate application:didFinishLaunchingWithOptions:] 中添加:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSString * const licenseURL = @"<获取到的licenseUrl>";
NSString * const licenseKey = @"<获取到的key>";

// V2TXLivePremier 位于 "V2TXLivePremier.h" 头文件中
[V2TXLivePremier setLicence:licenseURL key:licenseKey];
[V2TXLivePremier setObserver:self];
NSLog(@"SDK Version = %@", [V2TXLivePremier getSDKVersionStr]);
return YES;
}

#pragma mark - V2TXLivePremierObserver
- (void)onLicenceLoaded:(int)result Reason:(NSString *)reason {
NSLog(@"onLicenceLoaded: result:%d reason:%@", result, reason);
}
@end
Android 建议在 application 中添加:
public class MApplication extends Application {

@Override
public void onCreate() {
super.onCreate();
String licenseURL = ""; // 获取到的 license url
String licenseKey = ""; // 获取到的 license key
V2TXLivePremier.setLicence(this, licenseURL, licenseKey);
V2TXLivePremier.setObserver(new V2TXLivePremierObserver() {
@Override
public void onLicenceLoaded(int result, String reason) {
Log.i(TAG, "onLicenceLoaded: result:" + result + ", reason:" + reason);
}
});
}
HarmonyOS
建议在 EntryAbilityonCreate 中添加:

export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
let licenseUrl: string = "<获取到的licenseUrl>";
let licenseKey: string = "<获取到的key>";
let observer: V2TXLivePremierObserver = {
onLicenceLoaded: (result: number, msg: string) => {
}
};
getV2TXLivePremierShareInstance(this.context).setObserver(observer);
getV2TXLivePremierShareInstance(this.context).setLicence(licenseUrl, licenseKey);
}
}
注意:
直播 License 集成使用腾讯特效(美颜特效)功能时,License 设置方法如上,但工程需要额外进行配置,具体操作请参见:
License 为云端下载,当前网络环境需支持 http/https 协议。

查看方法

License 设置成功后(需稍等一段时间,具体时间长短依据网络情况而定),您可以通过调用如下方法查看 License 信息:
iOS
NSLog(@"%@", [TXLiveBase getLicenceInfo]);
Android
TXLiveBase.getInstance().getLicenceInfo();
HarmonyOS
暂未提供 getLicenseInfo 来查看 License 信息。