Class Info |
|---|
public abstract class WisePlayerFactory WisePlayer播放器工厂类。 |
WisePlayer播放器工厂类,您可以在完成工厂类初始化后,通过工厂类实例创建一个WisePlayer播放器实例。
// WisePlayer播放器工厂
private WisePlayerFactory factory = null;
// 初始化WisePlayer播放器工厂
private void initFactory(){
WisePlayerFactoryOptionsExt.Builder factoryOptions = new WisePlayerFactoryOptionsExt.Builder().setDeviceId("xxx");
// 设置日志配置信息
LogConfigInfo logCfgInfo = new LogConfigInfo(1, "", 20, 1024);
factoryOptions.setLogConfigInfo(logCfgInfo);
WisePlayerFactory.initFactory(context, factoryOptions.build(), new InitFactoryCallback() {
@Override
public void onSuccess(WisePlayerFactory wisePlayerFactory) {
// 初始化成功
factory = wisePlayerFactory;
}
@Override
public void onFailure(int errorCode, String message) {
// 初始化失败,记录失败日志
log.e("init player factory fail reason :" + message + ", errorCode is " + errorCode);
}
});
}
// 使用WisePlayer工厂创建播放器实例
private WisePlayer getPlayer() {
if (null != factory) {
try {
return factory.createWisePlayer();
} catch (CreateComponentException e) {
Log.w("create wisePlayer error:" + e.getMessage());
}
}
return null;
} Qualifier and Type | Method Name and Description |
|---|---|
public static void | initFactory(Context context, WisePlayerFactoryOptions options, InitFactoryCallback callback) 初始化WisePlayer播放器工厂。 |
public static void | initFactory(Context context, WisePlayerFactoryOptionsExt options, InitFactoryCallback callback) 初始化WisePlayer播放器工厂。 |
public static void | updateServeCountry(String serveCountry) 更新国家/地区码(GRS)。 说明:
|
public boolean | 获取VideoKit动态加载是否成功 |
public abstract WisePlayer | createWisePlayer() throws CreateComponentException 创建WisePlayer播放器实例。 |
public abstract Preloader | createPreloader() throws CreateComponentException 创建预加载实例。 |
public static void | release(Context context) 解绑播放器服务,释放播放器进程。 |
public static void | reportException(Thread thread, Throwable throwable) 向VideoKit报告异常信息,仅VideoKit运行在前台服务模式支持。 |
Method |
|---|
public static void initFactory(Context context, WisePlayerFactoryOptions options, InitFactoryCallback callback) 初始化WisePlayer播放器工厂。 |
Parameters
Name | Description |
|---|---|
context | Android Context对象,非空。 |
options | WisePlayer播放器工厂初始化选项WisePlayerFactoryOptions实例。 |
callback | WisePlayer播放器工厂初始化回调接口InitFactoryCallback实例。 |
Method |
|---|
public static void initFactory(Context context, WisePlayerFactoryOptionsExt options, InitFactoryCallback callback) 初始化WisePlayer播放器工厂。 |
Parameters
Name | Description |
|---|---|
context | Android Context对象,非空。 |
options | WisePlayer播放器工厂初始化选项WisePlayerFactoryOptionsExt实例。 |
callback | WisePlayer播放器工厂初始化回调接口InitFactoryCallback实例。 |
Method |
|---|
public static void updateServeCountry(String serveCountry) 更新国家/地区码(GRS)。 |
Parameters
Name | Description |
|---|---|
serveCountry | 说明:
|
Method |
|---|
public boolean isDynamicLoadSuccess() 获取Video Kit动态加载是否成功。 |
Returns
Type | Description |
|---|---|
boolean | Video Kit动态加载是否成功。
|
Method |
|---|
public abstract WisePlayer createWisePlayer() throws CreateComponentException 创建WisePlayer播放器实例。 |
Returns
Type | Description |
|---|---|
WisePlayer播放器实例对象。 |
Exception
Type | Description |
|---|---|
创建播放器组件异常。 |
Method |
|---|
public abstract Preloader createPreloader() throws CreateComponentException 创建预加载实例。 |
Returns
Exception
Type | Description |
|---|---|
创建播放器组件异常。 |
Method |
|---|
public static void release(Context context) 解绑播放器服务,释放播放器进程。 说明: 调用release释放播放器进程后,需要再次调用initFactory初始化播放器,并使用onSuccess回调的WisePlayerFactory对象创建播放器实例或者预加载对象。如果还是使用之前的WisePlayerFactory创建播放器实例或者预加载对象,会报exception错误,并返回null。 |
Parameters
Name | Description |
|---|---|
context | Android Context对象,非空。 |