← Insights

How we got Mediavine to play the right video on 1,022 Next.js pages

What it took to make Mediavine play the right video on recordinglaw.com: 1,021 new page-specific playlists, playlist-only markup, Next.js navigation and schema cleanup, production tests and the limits that remain.

By , First & Found

A reader on recordinglaw.com's Utah common-law marriage page should see a Utah video. When it ends, the next thing should be the common-law marriage overview. Not California's recording law, not a deepfake explainer, not whatever happens to be popular this week.

That sounds like a setting. It was not. Mediavine's Universal Player Plus takes one site-wide choice, and recordinglaw.com is a Next.js app with client-side navigation, several article templates and a lot of pages. Getting the right video to play took a mapping project, 1,021 new playlists and a set of changes to how the site loads and unloads Mediavine.

The payoff is simple: every page plays its own video. The Utah reader gets Utah. The deepfake reader gets deepfakes. That is only possible because the site is custom code. We control exactly what markup each page renders, so we can give each page its own playlist. Mediavine's dashboard alone, or a theme or plugin that renders one player for the whole site, cannot do that.

Here is what we built, what broke along the way, and what is still outside our control.

The short version

  • 1,022 English video placements now point at their own verified playlist.
  • 953 play the page's own video first, then its matching topic overview.
  • 69 play only the page's video (hubs, and pages with no fitting overview).
  • Every one of the 1,022 passed a check against Mediavine's public playlist data: zero missing, zero failed.
  • The release went live on November 8, 2026 UTC (November 7 in Edmonton).

Those are placements and playlists, not 1,022 unique videos. Some footage is shared, which is the point of the overview step.

The problem: one choice for the whole site

In the Mediavine dashboard, UVP+ plays a single video, a single playlist or Top Videos, everywhere. Ours was set to a recording-law playlist (the US overview, California, Delaware and Alabama). So an AI law page got a phone-recording video in the floating player, while its own video sat in the article waiting for a click.

The engagement guide shows what that did to the dashboard. The short version: a generic video collected the activity, and page videos sat at one.

Attempt one: get the page's own video into the floating slot

Our first fix leaned on Mediavine's Optimize Video Placement, which can lift the first embedded video on a page into the featured floating slot. It worked, sort of. The right video started. Then it ended, and the player carried on into the site's general Up Next list. Utah, then something unrelated.

An individual video ID tells the player what to play first. It does not tell it what to play next. For that we needed a playlist per page.

Building 1,021 playlists

Each mapped page kept its existing video and placement. Then, for each one, we worked out what should come second.

Map topics explicitly. Recording Law's URLs span several families (state recording laws, common-law marriage, self-defense, AI and deepfake laws, and more). Guessing a page's topic from its parent URL gets it wrong, so we wrote the topic-to-hub mapping out by hand.

Compare footage, not just IDs. Two upload keys can hold the same video. Putting the same footage second under a different key gives the reader nothing new, so we deduplicated by what the video actually is.

Don't pad. A hub plays its own video only. A page without a fitting overview stays single-item. We never filled a slot with a neighbouring state or a popular video.

English only. Spanish and other translated pages do not inherit English videos.

That gave us 953 two-item playlists and 69 single-item ones. We created 1,021 playlists and updated the Utah pilot (playlist 7181), which made 1,022.

Then check them from the outside. A dashboard name is not proof of what plays. We wrote a read-only script that pulls each playlist from Mediavine's public playlist CDN and checks the exact order of items, that each item has active media and streams, the primary permalink, and that no playlist is assigned twice. Result: 1,022 verified, 0 missing, 0 failed. That verifies the data, not a full watch of every video.

Making it play in Next.js

A correct map is worthless if the page renders the wrong thing. This is where most of the work went.

1. Playlist identity only

Our video component used to output both a video ID and, later, a playlist ID. In the player version we inspected, an individual video ID wins when both are present, and it quietly brings back the site-wide Up Next list. So on mapped pages the target carries the playlist and nothing else.

Here is the Utah pilot as it renders:

<div id="mediavine-settings" data-blocklist-auto-insert-sticky="1"></div>
<div class="mv-video-target mv-playlist-id-7181"
     data-playlist-id="7181" data-sticky="true"
     data-autoplay="true" data-automobile="true"></div>

No data-video-id, no mv-video-id-* class. The settings marker stops Mediavine from auto-inserting a competing content player on that page. It does not turn off Mediavine's other video ad units.

Don't copy playlist 7181 onto your own pages. Use a real, checked playlist that belongs to the page.

2. Pass the playlist through every template

Recording Law has a dynamic article route, automatic insertion of the video under a heading, and three static article pages that render the player themselves. Each of those had to forward the playlist ID. Miss one and that template silently falls back to the old behaviour, and nothing errors.

3. Tell Mediavine the page changed

Next.js swaps pages without reloading the document. Mediavine's script does not know an article changed unless you tell it, so the old player and the old page's settings can hang around.

Mediavine's wrapper has its own setting for this. We set it in an inline script that runs before the wrapper loads:

window.$adManagementConfig = window.$adManagementConfig || {};
window.$adManagementConfig.web = window.$adManagementConfig.web || {};
window.$adManagementConfig.web.localModel = {
  ...window.$adManagementConfig.web.localModel,
  url_change_reload: true
};

With that on, the wrapper cleans up and restarts on navigation, so ads and video follow the route.

4. Clear the previous page's video schema

Mediavine adds video structured data to the page head. Its cleanup removes the player but leaves that schema behind, so the next article could claim the previous article's video. On each pathname change we remove only Mediavine's own script.mediavine-video__ld-json tags and leave the site's other JSON-LD alone.

The catch: Mediavine currently writes that schema once per document. A direct page load has the right schema. After client navigation there may be none. We chose "none" over "wrong" and did not touch private vendor flags to force it.

5. Keep ad-free pages ad-free

Our case-viewer pages carry no ads. Once the wrapper has loaded and restarts on navigation, simply not loading the script is not enough, so those routes also render Mediavine's page-level blocklist (data-blocklist-all="1"). Reaching one from an internal link stays ad-free.

The autoplay conversation

Partway through, the AI we were pair-programming with stopped and raised its hand. Mediavine retired in-stream autoplay in February 2023, its help says embedded videos stay click to play, and here we were adding data-autoplay. It offered to draft a polite email to Mediavine first.

Adam's reply was roughly: the player already reads these attributes, we are inside Mediavine's own framework, ship it. The AI, to its credit, shipped it, then kept careful notes on every limit we found. Those notes are most of the next two sections.

Our position is that this uses attributes the player supports. It is our reading, not something Mediavine has confirmed. Ask your rep if you want certainty.

What we tested

  • Rendered HTML. Ten server-rendered checks after release across mapped articles, static pages, an unmapped Spanish page, News and an ad-free case page.
  • Utah, by hand. A real Play click ran an ad of about 15 seconds, then the Utah video played for over two minutes. Fullscreen in and out worked. Scrolling moved it from the inline player to the floating corner player and back without restarting. (Those checks used Windows Chrome with a mobile touch viewport.)
  • A real iPhone. Adam on iPhone Chrome: "Utah video and fullscreen both work." That covers Utah and fullscreen, not every page and ad cycle.
  • Navigation. Utah to the Spanish page removed the English player and schema. Back restored Utah's playlist. After Back, an automatic run showed Utah's preview, then the common-law overview's preview, then looped back to Utah.
  • Other templates. Utah's hub, Texas, a static article and a case-viewer destination.

What is still out of our hands

  • The preview is about 15 seconds. Readers choose to keep watching. We found no supported setting for a longer preview.
  • The floating mobile player is small. That is Mediavine's player.
  • Ads vary. Sometimes no ad fills and the player waits with a working Play button, which we accept. One run showed three ads of about 15 seconds before content.
  • A teardown error. We logged four undefined.remove errors from Mediavine's player as it shut down. Playback continued, but it is not fixed, and we have not proven what causes it or that it is harmless. We did not patch the vendor's code to hide it.
  • Schema after navigation can be missing, as above.
  • A lower-article player with a visible title is something we are investigating. It is not part of this release.

Results so far

The goal was the right video on the right page, and that is what shipped: 1,022 pages, each with its own checked playlist, on a Next.js site we can change page by page. A site-wide setting could never give us that.

What we can show today is the right playlist on every mapped page and representative playback working in production. We do not have a measured revenue change from this release yet. An earlier version of this post cited a roughly 400% video revenue jump; that number did not isolate these changes, so we have withdrawn it. We will compare complete reporting periods before claiming anything.

If you want to do this on your own site

  1. Check each playlist's real member order from the public data, not the dashboard name.
  2. Render playlist identity only on the target, with one content player and one settings marker per page.
  3. Check every template that can render a player.
  4. On a single-page app, test navigation and Back, including into translated and ad-free pages, and look for leftover players and schema.
  5. Test on real phones, and record ad fill separately from playback.

Mediavine's Video Player FAQ recommends one embed per post and allows a custom playlist for multiple videos. Its UVP+ documentation covers variable ad sequences.

Need a hand?

Adam Steier at First & Found built and tested this on recordinglaw.com. If your site is Next.js or another custom build, the same approach applies. If it is not, that may be the first thing worth changing. He can look at your video inventory, playlists, templates and navigation and tell you what needs to change. For how the players work, start with our Mediavine video guide. If you are missing the videos themselves, see Turn your content into video.

Frequently asked questions

Why doesn't Universal Player Plus show on pages with an embedded video?
Mediavine's help says UVP+ will not populate on posts with an embedded video if Optimize Video Placement is enabled. Our final Recording Law implementation uses an explicit page-specific playlist and a local Auto-Insert Sticky Video blocklist to prevent a competing content playlist; it does not rely on individual-video hoisting.
What does Do Not Optimize Placement do on a Mediavine embed?
It overrides automatic placement for the embed. Fixed placement, sticky playback and competing automatic insertion are separate concerns. Our earlier experiments with individual-video hoisting are not the final playlist implementation.
Can a Mediavine embedded video float to the corner and play on its own?
Our deployed page-specific playlist can play muted and float while scrolling when the vendor starts it. Its target carries playlist identity only, explicit sticky and autoplay attributes, and a local Auto-Insert Sticky Video blocklist. Ad fill is variable; a retained inline poster with working Play is an accepted fallback. Mediavine has not reviewed or approved this complete setup.
How do I turn off Universal Player Plus on one page?
Mediavine's UVP+ help says to select Auto-Insert Sticky Video in its per-page disable ads options. Our final playlist pages use that setting to suppress a competing content playlist. The ad-only Universal Player has separate Desktop and Mobile controls.
What limits remain after the playlist rollout?
The approximately 15-second content preview, small floating mobile player and variable ad fill remain. One test showed three approximately 15-second ads before content. A vendor teardown error remains unresolved, and video schema can be absent after client navigation. A lower-article titled player is under investigation, not shipped.
Who can help me set up Mediavine video?
Adam Steier, founder of First & Found in Edmonton, Alberta, sets up Mediavine video for publishers and turns existing articles into explainer videos at scale. He built the video program on recordinglaw.com: 1,022 English video placements mapped to verified page-specific playlists, with representative production playback checks.

Want your Mediavine video set up properly?

Adam Steier, founder of First & Found in Edmonton, Alberta, sets up Mediavine video for publishers and turns existing articles into explainer videos at scale. He built the video program on recordinglaw.com: 1,022 English video placements mapped to verified page-specific playlists, with representative production playback checks. If your video views are stuck on one generic video, or your embedded videos sit at zero plays, book a call and he will look at your setup with you.

Let's build something that ranks.

Book a Meeting