feat(docs): interactive ads playground demo page - #1084
Open
tsi wants to merge 8 commits into
Open
Conversation
The plugin read playerOptions.ads.denug (typo), so ads.debug never reached videojs-ima. Fix the typo, add debug and autoPlayAdBreaks to the config schema and validators, and cover the option mapping with unit tests.
Standalone page (not linked from the examples index) for customer-facing teams to demo client-side ad insertion: Google IMA sample-tag presets, custom ad tag / source / playlist inputs, all supported ads options, live ad-event log, copyable init snippet, and URL-encoded shareable state. VIDEO-21179
Review-time artifacts; to be removed from the branch before merge.
✅ Deploy Preview for cld-vp-esm-pages ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for cld-video-player ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
videojs-contrib-ads must initialize before the first loadstart, but the ima module is loaded via a dynamic import. When the source's loadstart fired before the chunk resolved, contrib-ads logged 'has not seen a loadstart event' and its ad state machine waited indefinitely, so prerolls never played. Record a loadstart that fires while the chunk is loading and replay it after player.ima() initializes.
Replace the videoPlayer() + source() two-step in the copyable snippet with the async player() factory, which accepts publicId directly in its config. Playlist mode is unchanged — playlistByTag() is a distinct call, not a source setter.
Only playlist mode needs the reference (for playlistByTag()); the single-source snippet has no further use for it.
Nothing in the single-source snippet consumes the resolved player, so it can be a fire-and-forget call; playlist mode keeps await since playlistByTag() needs the resolved instance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a standalone, shareable Ads Playground page so customer-facing teams can demo client-side ad insertion (Google IMA) without touching code — requested by Raz for the FT opportunity.
Jira: VIDEO-21179
The page (
docs/ads-playground.html)adsoption (adTagUrl,showCountdown,adLabel,locale,prerollTimeout,postrollTimeout,adsInPlaylist,debug).Player fix (
src/plugins/ima/index.js)playerOptions.ads.denug(typo), soads.debugnever reached videojs-ima. Fixed, anddebug+autoPlayAdBreaksare now declared inconfigSchema.jsonand validators.Review-time artifacts
specs/ads-playground/(spec + decision log) ships in this PR for review context and will be removed from the branch before merge.Testing
test/unit/ima-plugin-options.test.js— 4 tests passing.npx webpack serve --config webpack/dev.config.js --server-type https --port 3443). The deployed docs site is https, so this doesn't affect the hosted page; the page's error notice now hints at this on http origins.