Skip to content

Instantly share code, notes, and snippets.

@jakub-g
Last active June 2, 2020 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakub-g/89613ccf35a98577ab9c8b9f20955eab to your computer and use it in GitHub Desktop.
Save jakub-g/89613ccf35a98577ab9c8b9f20955eab to your computer and use it in GitHub Desktop.
Deprecation Dailymotion postMessage API

Context

If you landed on this page, you probably found a message like this in your logs:

This page is using deprecated Dailymotion postMessage API communication format that will be soon removed.
Please update your code. See https://gist.github.com/jakub-g/89613ccf35a98577ab9c8b9f20955eab for details.

Two possibilities

There are two possibilities how this could happen

  1. Your page is using bundled Dailymotion JS SDK and you have a severely outdated copy (note: we strongly discourage that; you should always use the latest SDK directly from our servers).

In such case, you should drop your copy of the SDK, and replace it with the one at https://api.dmcdn.net/all.js.

  1. Your page is not using Dailymotion JS SDK, but communications with Dailymotion embed iframe via postMessage API.

In such case, you should migrate your postMessage calls as in the examples below:

-  .contentWindow.postMessage("play"', "*")
+  .contentWindow.postMessage('{"command":"play"}', "*")

(similar for pause, mute etc.)

-  .contentWindow.postMessage("volume=0"', "*")
+  .contentWindow.postMessage('{"command":"volume", "parameters":["0"]}', "*")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment