SporfieSporfie
Pricing
Contact
SporfieSporfie

The complete video platform for sports.

  • Facebook
  • Instagram
  • X
  • YouTube

Platform

  • Features
  • Pricing
  • Shop
  • Blog
  • API

Legal

  • Service Status
  • Contact
  • Terms of Use
  • Privacy Policy
  • Community Guidelines

Get in touch

  • +1 480 584 0197
  • contact@sporfie.com
  • Support

© 2026 Sporfie. All rights reserved.

Documentation
Embed
v1
  • Configuration
  • Timestamp API
v3beta
  • Configuration
Sporfie API documentation

Embed Player Timestamp Messaging API (DRAFT)

This document describes the request and response message format used to request the absolute timestamp of the content played by the Sporfie player embedded within an iframe using the postMessage() API.

Type Definitions

ts
type TimestampRequest = {  version: 1;  type: "sporfie:request-absolute-timestamp";  requestId?: string;};type TimestampResponse = {  version: 1;  type: "sporfie:absolute-timestamp";  requestId?: string;  eventKey: string | null;  absoluteTimestampMs: number | null;  absoluteTimestampIso: string | null;  error?: "not-ready" | "unresolved";  emittedAtMs: number;};

Implementation Example

ts
const iframe = document.querySelector("iframe");const sporfieOrigin = "https://www.sporfie.com";// requestId is optional – set it if you have multiple embeds, repeated requests.const requestId = `request-${Date.now()}`;const request = {  version: 1,  type: "sporfie:request-absolute-timestamp",  requestId,};iframe?.contentWindow?.postMessage(request, sporfieOrigin);window.addEventListener("message", (event) => {  if (event.origin !== sporfieOrigin) return;  const data = event.data as TimestampResponse;  if (data.type !== "sporfie:absolute-timestamp") return;  // Only check requestId if you sent one.  if (request.requestId && data.requestId !== request.requestId) return;  console.log("Timestamp ms:", data.absoluteTimestampMs);  console.log("Timestamp ISO:", data.absoluteTimestampIso);  console.log("Error:", data.error ?? null);});

Implementation Notes

  • Use an explicit Sporfie origin in postMessage, never "*"
  • The iframe replies only to event.source and uses event.origin
  • requestId is optional, but useful for matching responses
  • error: "not-ready" means the player is not ready yet
  • error: "unresolved" means the player cannot safely map the current playback position to a real absolute time

Embed player timestamp demo

Load an embedded player and request its current absolute timestamp via postMessage.

Embed URL
Enter an event key to load the iframe.
Load an event to render the embed iframe.

Event log

0
No messages yet.