initalize method

  1. @override
void initalize(
  1. THEOplayerConfig theoPlayerConfig,
  2. InitializeNativeResultCallback callback
)
override

Initializes the native player on the underlying platform

  • for PlatformViews nothing happens here (yet)
  • for Textures the player will be created

Implementation

@override
void initalize(THEOplayerConfig theoPlayerConfig, InitializeNativeResultCallback callback) {
  if (!theoPlayerConfig.androidConfig.viewComposition.isPlatformView) {
    // Pass parameters to the platform side.
    Map<String, dynamic> creationParams = <String, dynamic>{};
    creationParams["playerConfig"] = theoPlayerConfig.toJson();

    PlatformPlayersService.instance.createPlayer(creationParams).then((value) =>
        callback(value)
    );
  } else {
    // return -1 as default, as the [buildView] method doesn't care about this anymore for PlatformViews
    callback(-1);
  }
}