configure method
配置播放控制器
Configure the player controller with the given data.
data
The configuration data for the player, including video URL and other settings.
Implementation
void configure(AliPlayerWidgetData data) {
logi("[api][configure]: $data");
_widgetData = data;
// 列表播放模式下,允许预渲染
if (_widgetData?.sceneType == SceneType.listPlayer) {
_aliPlayer.setOption(FlutterAvpdef.ALLOW_PRE_RENDER, 1);
}
// 配置播放源
_configurePlayerSource(data);
_aliPlayer.setEnableHardwareDecoder(data.isHardWareDecode);
_aliPlayer.setStartTime(data.startTime, data.seekMode);
_aliPlayer.setAutoPlay(data.autoPlay);
// 准备播放
prepare();
// 允许屏幕常亮
if (_widgetData?.allowedScreenSleep == true) {
WakelockPlus.enable();
}
}