Skip to content

Instantly share code, notes, and snippets.

@jakub-g jakub-g/README.md

Last active Jun 2, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.