Player events & playback sync

Iframely iFrames give you an option to listen, react or control embedded video playback with JavaScript using unified events-methods model.

That flow relies on cross-window communication via postMessage mechanism available for iFrames. To make it happen, Iframely adds JavaScript connectors for number of video publishers, unifying their various APIs into a consistent event model.

Say, you may listen to an event that video is paused or start video playback using your custom button. Our iFrames helpers can cover one use-case out-of-the-box: make sure that only one player is active at a time.

Supported publishers

Iframely recognizes YouTube, Vimeo, SoundCloud, Dailymotion, Brightcove, Streamable, Vid.me, Facebook videos, Wistia, Coub, all MP4 videos (+ friendly gifs), Office Mix, sendvid, playstv.

We constantly monitor, discover and add new publishers that can fit into unified events API.

Player events API

Iframely events API follows Player.js spec, published under Creative Commons by our colleagues from Embedly.

  • Add &playerjs=true to your API calls to get Iframely iFrames that follow Player.js spec. It works when Iframely iFrame is returned.
  • To orchestrate the players, you can get player.js library on GitHub, or simply listen to the specified events yourself.
  • If you use Iframely JSON as your API format, check rel array attribute. We add playerjs value there if we could make player be compatible.

Playback sync

The most common use case for player events is to synchronize playback accross multiple videos on your site. So that when user clicks to play a new video - the one that is already playing will stop automatically.

Iframely covers this feature without the need to handle events on your side. Simply activate it in your player settings, and Iframely will let only one video play at a time (among popular players that we can control).

Quick demo

Here's the playback sync in action. Try starting a video, and then another. It works across multiple browser tabs too.

YouTube

Vimeo

Streamable

MP4

Coub

Facebook

Soundcloud

Previous article: Lazy-loading
Next article: Short IDs