adplayer_flutter_plugin 1.2.0
adplayer_flutter_plugin: ^1.2.0 copied to clipboard
A Flutter plugin for using the native AdPlayer SDK.
AdPlayer Flutter Plugin #
A Flutter plugin for using the native AdPlayer SDK.
Getting Started #
Setup #
To gain access to the AdPlayer APIs, first initialize AdPlayer SDK:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await AdPlayer.initialize(
iosStoreUrl: "STORE_URL_TO_YOUR_APP" // mandatory only for iOS
);
await AdPlayer.initializePublisher(publisherId: pubId, tagId: tagId);
runApp(const MyApp());
}
Display #
The player is displayed with the help of AdPlayerPlacementWidget widget:
@override
Widget build(BuildContext context) {
return AdPlayerPlacementWidget(tagId: tagId);
}
Preloading Video #
Video AD can be preloaded with the help of AdPlayerTag.preloadVideo method:
await AdPlayerTag.preloadVideo(tagId);
// AD is ready to be displayed