MethodChannelVideoPlayerWin constructor
MethodChannelVideoPlayerWin()
Implementation
MethodChannelVideoPlayerWin() {
assert(() {
// When hot-reload in debugging mode, clear all old players created before hot-reload
methodChannel.invokeMethod<void>('clearAll');
return true;
}());
methodChannel.setMethodCallHandler((call) async {
//log("[videoplayer] native->flutter: $call");
int? textureId = call.arguments["textureId"];
assert(textureId != null);
final player = playerMap[textureId];
if (player == null) {
log("player not found: id = $textureId");
return;
}
if (call.method == "OnPlaybackEvent") {
int state = call.arguments["state"]!;
player.target?.onPlaybackEvent_(state);
} else {
assert(false, "unknown call from native: ${call.method}");
}
});
}