Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<div>
  Player 360
</div>
<div>
  <iframe
    id="foo"
    width="640"
    height="360"
    src="https://mediacloudapi-cea.azurewebsites.net:/api/media/play.html?PlayerUid=h5c530c2c88b87&MediaUid=158c3309-d148-4a26-bc55-d5b2ea3cc84d&Width=640px&Height=360px&Share=false&chromeless=true"
    allow="autoplay; fullscreen"
    frameborder="0"
    scrolling="no"
    allowfullscreen="true"
    webkitallowfullscreen="true"
    mozallowfullscreen="true" ></iframe>
</div>
<div>
  <h4>Controls</h4>
  <div>
    <button
      onmousedown="sendPlayerEvent('turn360Left')"
      onmouseup="sendPlayerEvent('stopTurning360')"
    >
      <-
    </button>
    <button
      onmousedown="sendPlayerEvent('turn360Right')"
      onmouseup="sendPlayerEvent('stopTurning360')"
    >
      ->
    </button>
  </div>
</div>
</body>
</html>
 
function sendPlayerEvent(name) {
  console.log('yoyoyoyo', name)
  var iframe = document.getElementById('foo');
  if (iframe && iframe.contentWindow) {
    console.log('will send', iframe.contentWindow)
    iframe.contentWindow.postMessage(
      {
        source: 'dam',
        name: name,
      },
      '*'
    )
  }
}
window.addEventListener('message', (message) => {
  console.log('message ??? ', message)
  if (message.data.name === 'mediaInfos') {
    console.log('Player loaded')
  }
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
K0d1Lupro
0viewers