Media Placement
Media (InRead) renders a premium video or display ad inline in your content. MediaPlacement is a widget that sizes itself: it reserves 250 logical pixels until the native SDK reports the creative's real height, then resizes.
The plugin's example app, shipped with the teads_flutter package, includes a working screen for this format. Use it as a reference while you set up this placement.
Example
import 'package:flutter/material.dart';
import 'package:teads_flutter/teads_flutter.dart';
class ArticleScreen extends StatelessWidget {
const ArticleScreen({super.key});
Widget build(BuildContext context) {
return ListView(
children: [
const Text('Article content here…'),
MediaPlacement(
config: MediaPlacementConfig(
pid: 84242, // Provided by your Teads account manager
articleUrl: 'https://example.com/article/123',
),
onReady: () => debugPrint('Media ad ready'),
onFailed: (TeadsAdError error) => debugPrint('Media failed: ${error.reason}'),
onClicked: (TeadsAdClick click) {
// The SDK opens the click-through itself. Use this for your own analytics.
},
),
const Text('More article content…'),
],
);
}
}
pid is an intMedia takes a numeric placement ID, unlike the string widget IDs of the other formats. MediaPlacementConfig(pid: '84242') does not compile.
Validation mode
enableValidationMode forces a test creative, so the placement renders without a live campaign. Useful while wiring up layout — remove it before release.
MediaPlacementConfig(pid: 84242, enableValidationMode: true)
Best Practices
Don't wrap MediaPlacement in a fixed-height SizedBox — the creative resizes the widget as it renders, and a fixed height clips it.
The SDK opens the paid onClicked URL. Opening click.url yourself as well opens the browser twice. Use the callback for tracking only.
No widget may cover the placement — not even a transparent Opacity, IgnorePointer or Stack overlay. It breaks viewability measurement.
Configuration
Every MediaPlacementConfig field and MediaPlacement property is in Settings.
Ad Lifecycle Listener
onReady, onFailed, onClicked, onClickedOrganic and onEvent observe playback, clicks and viewability. See Placement Events Listener for the full event reference.
Checklist
- ✅ Ensure Brand Safety is enabled: pass the real
articleUrl - ✅ Ensure you comply with privacy legal requirements (GDPR/CCPA/GPP)
- ✅ Comply with app-ads.txt
- ✅ Handle
onFailed - ✅ Test with the PIDs in Test PIDs and Configurations, and remove
enableValidationModebefore release