DocsArticle Audio

Article audio with VoicePort

Prepare and review a complete spoken version of an article before embedding it. Enable playback only after its audio and published snapshot are approved and the server and widget support the strict contract. Keep the written article available.

Strict playback contract

Load https://voiceport.theproductivepixel.com/widget/v1.js, then check capabilities.strictNarration equals 1. Mount returns an idempotent disposer or null. The approved snapshot contains version 1, a revision, partCount and ordered, unique partTokens. Each revision binds the exact ordered content, including unavailable positions. A refreshed URL response must retain that identity.

// approvedArticle comes from your reviewed server-side article binding.
const widget = window.VoicePort;
let dispose;
if (widget?.capabilities?.strictNarration === 1) {
  dispose = widget.mount(host, {
    code: approvedArticle.code,
    apiBase: 'https://aitts.theproductivepixel.com',
    playlist: true,
    narration: approvedArticle.snapshot,
    onEvent(event) {
      if (event.type === 'failure') { dispose?.(); host.hidden = true; }
      // Transport observations only. Use your consent-gated analytics boundary.
      // playing is native playback; part_ended includes its opaque partToken.
    },
  });
  // Call dispose?.() when leaving the article or replacing this mount.
} else {
  // Keep the written article available. Do not mount an older widget.
}

Strict mode reads the playlist only after Play. Missing, reordered or replaced parts fall back to the written article. Ordinary embeds retain their existing first-playable-track default; multipart playback is opt-in with playlist:true. No visitor request generates speech.

Events are play_requested, native playing, part_ended and terminal failure, with monotonic sequence and runId fields. Count transport completion only after every required unique part played and ended in one run. Seeking can reach an end; these events do not establish attention or listened-through.

Main site publishing

Bind the published title and HTML body to the reviewed script, exact voice and output settings. Publish only the approved snapshot identity. Update the article binding when its content changes; leave unapproved articles without a player. Run the full inventory audit before claiming complete coverage.

Productive Pixel publishing

Bind the title and Markdown body after frontmatter to the approved script and snapshot. Keep original publication dates and SEO fields. Qualify the exported site with its hosting CSP, including widget scripts, API connections and media. A changed neighboring article must not hide another valid narration.

Blog narration telemetry requires the visible analytics choice All. Necessary only, unknown choices and unavailable storage deny these new events. Preferences can withdraw them. This scope leaves existing site analytics policy unchanged. Signed media URLs can reveal storage paths, and publicly playable bytes can be saved.

VoicePort studioAPI examplesShare API reference