Web Player · v1

JavaScript API access

The WeCloud script exposes WeCloudPlayer. Pass a container or an existing empty iframe and a fresh playback pair:

<script src="https://player.wecloud.biz/wecloud-player.js"></script>
<div id="lesson"></div>
<script>
  const player = new WeCloudPlayer({
    container: document.getElementById('lesson'),
    otp: 'YOUR_OTP', playbackInfo: 'YOUR_PLAYBACK_INFO'
  })
  const unsubscribe = player.on('timeupdate', event => console.log(event.type))
  player.ready.then(() => player.play())
  // Later: unsubscribe(); player.destroy()
</script>

ready resolves when media has loaded and rejects with a public { code, requestId? } error or player_timeout. Methods called before readiness wait for it. Use on/off or addEventListener/removeEventListener for events. destroy() removes listeners and unloads the iframe. The bridge validates origin, window, and player instance, and sends no OTP, Playback Info, session token, or signed URL through control messages.