Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ class MyApp extends StatelessWidget {
child: FlutterVapView(
controller: vapController,
scaleType: VapScaleType.fitXY,
onCreateView: () {
// 现在可以在这里播放
},
onVideoStart: () {
debugPrint('VAP - 视频开始播放');
},
Expand Down
6 changes: 6 additions & 0 deletions lib/flutter_vap_view.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:io';
import 'dart:nativewrappers/_internal/vm/lib/ffi_allocation_patch.dart';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand All @@ -19,6 +20,7 @@ class FlutterVapView extends StatefulWidget {
this.onVideoRender,
this.onFailed,
this.scaleType = VapScaleType.fitXY,
this.onCreateView,
});

/// 外部控制器,必填
Expand All @@ -43,6 +45,9 @@ class FlutterVapView extends StatefulWidget {
/// Video scaling type, default is fitXY
final VapScaleType scaleType;

// 用于PlatformView创建完成后的回调
final VoidCallback? onCreateView;

@override
State<FlutterVapView> createState() => _FlutterVapViewState();
}
Expand All @@ -60,6 +65,7 @@ class _FlutterVapViewState extends State<FlutterVapView> {
_channel = MethodChannel('flutter_vap_plugin_$id');
_channel?.setMethodCallHandler(_handleMethodCall);
widget.controller.bindChannel(_channel!);
widget.onCreateView.call();
}

Future<dynamic> _handleMethodCall(MethodCall call) async {
Expand Down