Embedding
Calling methods
Every Playgent.init() returns a player instance. Drive playback, swap content, and fire share by calling methods on it.
A quick tour
js
const player = Playgent.init({ /* … */ });
player.play(); // resume from pause
player.restart(); // back to the cover screen
player.hint(); // reveal a hint (if hints are enabled)
player.openHowto(); // show the How to Play screen
player.openArchive(); // open the past games archive
player.loadDate("20260506"); // jump to a specific date in daily mode
player.mute(); // mute SFX/music
player.unmute();
player.share(); // trigger Web Share API or clipboard
player.destroy(); // teardown
Swapping content at runtime
load() reuses the iframe. Pass any subset of init options:
js
player.load({ game: "wordsearch", mode: "daily" });
player.load({ content: "pub_holiday_2026", mode: "pinned" });
player.load({ theme: "thm_dark_event" });
Updating identity mid-session
If your user logs in after the player has loaded, push the identity into the SDK without re-mounting:
js
player.setIdentity({
externalUserId: "u_12345",
externalUsername: "alice",
});
Subsequent events will carry the new identity.
Sharing
player.share() returns a Promise that resolves when the share UI dismisses. It must be called from a user gesture (click/tap) — otherwise browsers block the Web Share API:
js
shareBtn.addEventListener("click", () => {
player.share().catch(() => {
// Fallback: copy link manually, etc.
});
});
You can override the share text:
js
player.share({ text: "I solved today's Acme trivia in 47s — try it." });
Full reference
Every method, its parameters, and edge cases are on the SDK Methods page.