createPlayerView method

  1. @override
Widget createPlayerView({
  1. Key? key,
  2. Map<String, dynamic>? args,
  3. PlatformViewCreatedCallback? onViewCreated,
})
override

创建各平台对应的播放器

Implementation

@override
Widget createPlayerView({Key? key, Map<String, dynamic>? args, PlatformViewCreatedCallback? onViewCreated}) {
  if (PlatformUtils.isAndroid()) {
    log("createPlayerView.android");
    return AndroidView(
      key: key,
      viewType: LivePlayer.playerViewType,
      creationParams: args,
      creationParamsCodec: const StandardMessageCodec(),
      onPlatformViewCreated: onViewCreated,
    );
  }
  if (PlatformUtils.isIos()) {
    log("createPlayerView.ios");
    return UiKitView(
      key: key,
      viewType: LivePlayer.playerViewType,
      creationParams: args,
      creationParamsCodec: const StandardMessageCodec(),
      onPlatformViewCreated: onViewCreated,
    );
  }
  return Container();
}