flutter_vap은 Flutter 애플리케이션에서 알파 비디오 애니메이션을 재생할 수 있도록 해주는 네이티브 플러그인입니다. 개발자들은 Android 및 iOS 플랫폼의 앱에 투명하거나 반투명한 비디오 콘텐츠(예: 알파 채널이 있는 애니메이션 로고 또는 UI 요소)를 원활하게 통합할 수 있습니다. 이 플러그인은 효율적인 렌더링과 부드러운 성능을 위해 네이티브 기능을 활용합니다. 고품질의 애니메이션 시각 효과를 갖춘 풍부하고 동적인 사용자 인터페이스를 만들기에 특히 유용합니다.
Transparent video animation is currently one of the more popular implementations of animation. Major manufacturers have also open sourced their own frameworks. In the end, we chose Tencent vap, which supports Android, IOS, and Web, and provides natural convenience for us to encapsulate flutter_vap. Provides a tool to generate a video with an alpha channel from a frame picture, which is simply awesome.
VAP(Video Animation Player)is developed by Penguin E-sports and is used to play cool animations.
Compared with Webp and Apng animation solutions, it has the advantages of high compression rate (smaller material) and hardware decoding (faster decoding)
Compared with Lottie, it can achieve more complex animation effects (such as particle effects)
import'package:flutter_vap/flutter_vap.dart';
IgnorePointer(
// VapView can set the width and height through the outer package Container() to limit the width and height of the pop-up video
child: VapView(),
),
Play local video
import'package:flutter_vap/flutter_vap.dart';
/// return: play error: {"status": "failure", "errorMsg": ""}/// play complete: {"status": "complete"}Future<Map<dynamic, dynamic>> _playFile(String path) async {
if (path == null) {
returnnull;
}
var res = awaitVapController.playPath(path);
if (res["status"] == "failure") {
showToast(res["errorMsg"]);
}
return res;
}
Play asset video
Future<Map<dynamic, dynamic>> _playAsset(String asset) async {
if (asset == null) {
returnnull;
}
var res = awaitVapController.playAsset(asset);
if (res["status"] == "failure") {
showToast(res["errorMsg"]);
}
return res;
}
Stop play
VapController.stop()
Queue play
_queuePlay() async {。
// Simultaneously call playback in multiple places, making the queue perform playback.QueueUtil.get("vapQueue").addTask(() => VapController.playPath(downloadPathList[0]));
QueueUtil.get("vapQueue").addTask(() => VapController.playPath(downloadPathList[1]));
}