setOnGlobalInit static method

void setOnGlobalInit(
  1. OnGlobalInitCallback? callback
)

注册全局初始化自定义配置回调

Register a callback for custom global initialization configuration.

该回调会在 Widget 内部全局初始化完成后被调用,允许用户执行额外的全局设置操作。 建议在 Widget 使用前调用此方法(如 main() 中),确保全局配置在播放器创建前生效。

对于未通过 AliPlayerWidgetGlobalSetting 直接透出的全局接口 (如自定义 setOption 等),建议在此回调中自行调用实现。

The callback is invoked after the Widget's internal global initialization is complete, allowing users to perform additional global setup operations. It is recommended to call this method before using the Widget (e.g., in main()) to ensure global configuration takes effect before any player is created.

For global APIs not directly exposed by AliPlayerWidgetGlobalSetting (e.g., custom setOption etc.), it is recommended to call them within this callback.

使用示例 / Usage example:

AliPlayerWidgetGlobalSetting.setOnGlobalInit(() {
  // 其他全局配置...
});

Implementation

static void setOnGlobalInit(OnGlobalInitCallback? callback) {
  _onGlobalInitCallback = callback;
}