Glomex: Embedded video-player integration

Glomex operated a video marketplace. Content owners supplied clips, and publishers could run those clips with advertising on their own sites and apps. I worked on the embedded player and the JavaScript Content SDK that publishers used to integrate video.

Problem
Putting a video in an article created an opportunity to show an ad. To understand how that placement performed, a publisher needed to know whether the reader saw the video, whether an ad ran and whether playback failed.
Decision
I made the player report failures across the iframe boundary and drove tracking requests from changes in player state. I documented the video and ad identifiers on public events so publishers could tell which item each event belonged to.
Result
On their own sites, publishers could identify the video or ad behind an event and tell whether a playlist, configuration or player error had interrupted playback. In Glomex’s publisher reports, they could compare video views and ad impressions by clip or page.
Context
Glomex - Web video player
Period
2018–2019
My focus & role
Player integration, cross-frame error events, tracking middleware, Content SDK APIs, startup behavior, and automated tests.
Technology
JavaScript · React · Redux · postMessage

Make the runtime result observable

Concept model - synthetic data

Publisher page

Public player API and event listeners

Ready to request playbackAn issued command does not establish that playback started.

Iframe runtime

Configuration, content, and player behavior

Waiting for commandThe runtime resolves the request inside its own frame.
Communication boundarypostMessage

No command or result has crossed the boundary.

  1. Await a command
  2. Send across the frame boundary
  3. Resolve inside the runtime
  4. Deliver the result to the publisher

Step 1 of 4. Await a command. Publisher: ready to request playback. Runtime: waiting for command.

FIG. 01 A deterministic explanation of the frame boundary. The public playerabort event and failure sources reflect the original integration; message wording, codes, and sequence are simplified examples. No video, iframe, or network request runs in this figure.

Embed a player without making the publisher own its internals

The marketplace connected owners of video rights with publishers looking for content for their sites and apps. Glomex handled video delivery, advertising and analysis. Publishers controlled where to place a clip and needed to see how it performed there. ProSiebenSat.1 described this model in the Glomex launch announcement.

My work in 2018–2019 focused on that integration layer and the Content SDK. I changed how the player handled state, sent tracking requests, reported errors, and made startup decisions. I also worked on tests and documentation. The player platform and its surrounding services were an existing system developed by several engineers.

Separate the embedding surface from the player runtime

The documented architecture placed a publisher-facing custom element outside an iframe and the player runtime inside it. The outer component exposed the integration API; commands and events crossed the frame boundary through postMessage. Player adapters, advertising, and other runtime concerns stayed behind that boundary.

The iframe provided isolation from the host page. Its consequence was an explicit communication contract: sending a command and observing its result were different operations. A publisher could not infer that playback had started merely because it had requested playback. Configuration failures and player errors also needed a route back to the embedding application.

When an internal player outcome changed, I sometimes had to update how the component handled state and mapped the event to the public API. I also had to keep the public payload description in step with those changes. The component boundary made it easier to see where each change belonged.

Give failed playback an explicit public result

I added the public playerabort communication event and mapped playlist, remote-configuration, and general player errors into its payload. The event carried an abort reason, message, and code. This gave the publisher integration a specific failure signal instead of leaving the problem confined to the runtime.

The useful boundary was between the internal failure and the information an integrator could consume. Preserving the reason and code kept different failure paths distinguishable while providing one public event to listen for. The interactive sequence above shows that distinction: resolving a failure inside the frame is separate from reporting it to the host page.

An unavailable video in an embedded player

Original support screenshot
Black player surface with a German video-unavailable message and the error code “content, 3018”.View larger image (new tab)
FIG. 02 Glomex’s 2017 embedding guide shows what a viewer saw when the host domain was unregistered. The player displayed a message and code 3018. Reporting a failure to the host application was a separate part of the integration contract.

I also wrote player-event documentation with payload examples covering content and advertisement identifiers, ad-roll names, and indices. These details let an integrator associate an event with the relevant item or advertising position. The documentation was part of the API work, alongside the implementation that produced the events.

Keep tracking connected to application state

I changed the Redux state and tracking flow, introduced tracking middleware, and connected it to the request service. That work crossed the iframe player, integration, and state layers, including changes to analytics payload behavior.

State, tracking behavior, and request delivery

Player and integration state

Represent the runtime behavior that tracking needs to describe

Tracking middleware

Apply tracking behavior and prepare analytics payloads

Request service

Handle delivery of tracking requests

FIG. 03 Reconstructed responsibility view of the state and tracking refactor. Middleware tests exercised tracking behavior separately from request delivery. Private analytics fields and service details are omitted.

Glomex’s publisher reporting tutorial (PDF) shows how publishers compared video views and ad impressions by video, page or domain. A publisher could also listen for events on its own page. The current publisher analytics integration guide illustrates this with separate events for a content start and an ad impression, both carrying the video’s identifier into the publisher’s analytics.

Middleware provided an explicit place to relate state changes to tracking work. The request service handled the outgoing request boundary, while the middleware tests exercised the behavior that selected and prepared tracking information. Separating those concerns made the mapping inspectable without treating a successful request as proof that the right event or payload had been produced.

This also introduced a coordination requirement: changes to player events, state, and analytics payloads had to stay aligned. I added focused middleware tests with the implementation, protecting the mapping rather than relying only on a player appearing to work in a browser.

Extract startup decisions from initialization

Player startup depended on configuration and behavior settings, not simply on whether the component had mounted. In a later refactor, I removed legacy preset and start-setting activation, extracted the determination of player behavior, and updated bootstrap and state handling together.

The distinction was between deciding the intended behavior and performing initialization. An extracted decision boundary could be exercised with focused inputs, while bootstrap code applied its result. I added a dedicated test suite around this refactor. Updating both the decision path and its consumers mattered because leaving the old activation mechanism in place would preserve two competing sources of startup behavior.

Startup modes and sound settings

Original team behavior diagram
2019 startup diagram: click-to-play is marked for sound on, scroll-to-play for sound on or muted, and scroll-out-to-play for muted only.View larger image (new tab)
FIG. 04 The team’s 2019 diagram distinguishes three ways to start the player. For scroll-to-play it marks both sound settings as available. For scroll-out-to-play it marks only muted playback. Those combinations are inputs to the startup decision.

Startup policy also remained separate from what a browser or player ultimately permitted. Selecting an intended behavior did not establish successful playback; the runtime and its public events still needed to represent what actually happened.

Make source retrieval and tracking usable as an SDK

In the JavaScript Content SDK, I rewrote the video-source provider and separated source retrieval from tracking behavior. I revised initialization and the public API, added response-body error handling, and implemented provider and API tests.

I also introduced declarative default configuration, centralized page URL handling, and configuration validation. These were developer-facing concerns: a caller needed predictable setup and useful errors as well as a method that returned video sources. Handling the response body explicitly avoided treating completion of a request as sufficient evidence that the application-level result was usable.

The SDK work included package configuration and examples. It was a separate integration surface in the broader video ecosystem; it did not make the publisher responsible for the implementation of the underlying playlist and tracking services.

Project artifacts

The June 2018 team diagrams below show where the publisher, adapter, and video player connect. The unavailable-video screen and startup-mode diagram show how embedding and playback settings affected the viewer.

Publisher-to-player integration

Original team architecture diagram
Historical Glomex diagram showing a publisher custom element communicating with an iframe player adapter, video player, assets, integration, analytics, and advertising services.View larger image (new tab)
FIG. 05 The publisher element and iframe form the integration boundary. Player assets, content integration, analytics, and advertising remain distinct services around the runtime.

Player-adapter responsibilities

Original team architecture diagram
Historical Glomex adapter diagram separating public API, playback controls, UI overlays, player configuration, playlists, analytics, and ad scheduling between the iframe and video player.View larger image (new tab)
FIG. 06 The companion diagram expands the adapter into its API, playback, configuration, content, analytics, and advertising responsibilities. It provides context for why integration work crossed several modules while still needing a coherent publisher-facing contract.

Test the contracts and support integration

My changes included middleware tests, startup-behavior tests, and Content SDK provider, configuration, and API tests. I also built an initial JW Player evaluation interface to inspect a player option in the integration context. That was evaluation work, not a claim that I replaced the production player.

I contributed player API, AMP, and mobile WebView documentation and implemented CloudFront and S3 infrastructure configuration in the player repository. Those tasks extended the work beyond the playback interface into how the integration was delivered and used.

Publishers could see runtime failures through the integration API and use the documented SDK to retrieve sources and send tracking requests. I added tests for startup and tracking. My work was on the integration inside the larger player platform built by the team.