window.Moviie
The global object exposed by the Moviie Player and how to detect when it is ready.
When the player initialises, it attaches a Moviie object to the embed
page's window. Every method, event subscription and read-only property
documented in the reference is reachable from this object.
Detecting readiness
window.Moviie is created before the video metadata is loaded, so
methods that depend on the underlying <video> element (like play() or
seek()) may queue until the player is ready. The simplest way to wait
for the ready state is the ready event:
window.Moviie.on("ready", () => {
// Safe to call any API method here.
})If the player is already ready when you subscribe — for example, you register late — your handler is invoked synchronously on the next tick.
Inspecting the API surface
In the browser console, log the API to see what is available:
console.log(window.Moviie)You will find:
- Methods —
play,pause,seek,setVolume,enterFullscreen, … - Subscriptions —
on,once,off. - State accessors —
getState, plus shorthand getters likecurrentTime,duration,paused. - Versioning —
version(string).
The full inventory lives on the Reference pages.
Defensive integration
When integrating with frameworks that hot-reload (Next.js, Astro,
SvelteKit), the window.Moviie object can transiently be undefined
during navigation. Always guard the global before calling into it:
if (typeof window !== "undefined" && window.Moviie) {
window.Moviie.pause()
}For server-rendered code paths, prefer the event hooks: registering
on("ready", …) is idempotent and survives re-renders better than
imperative checks.