Skip to main content

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.


Sample App

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 int

Media 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​

Let the placement size itself

Don't wrap MediaPlacement in a fixed-height SizedBox — the creative resizes the widget as it renders, and a fixed height clips it.

Do not open the click URL

The SDK opens the paid onClicked URL. Opening click.url yourself as well opens the browser twice. Use the callback for tracking only.

Nothing on top of the placement

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​