Embed Methods

The code to embed a VideoKen video is given below. First, you need to obtain the video_id from Videoken Dashboard. A DOM element needs to be passed as the container for the video. A list of options can be passed to the player as well. Find the entire list of options here

  <div id="myvideo" style="width: 720px; height: 400px;"></div>
  <script src="https://dpht5nvkh9e19.cloudfront.net/videoken.js"></script>
  <script>
    const player = VideoKenPlayer({
        container: document.getElementById("myvideo"),
        video_id: "vken-1PUjgtAam1T",
        options: {
            logging: 0
        }
    });
  </script>

If you don’t want to use a blocking script and want the script to load asynchronously, use the following code snippet

  <div id="myvideo" style="width: 720px; height: 400px;"></div>
  <script>
    window.onVideoKenPlayerReady = function() {
        var player = VideoKenPlayer({
            container: document.getElementById("myvideo"),
            video_id: "vken-1PUjgtAam1T",
            options: {}
        });
    }

    const tag = document.createElement("script");
    tag.src = "https://dpht5nvkh9e19.cloudfront.net/videoken.js";
    document.head.appendChild(tag);
  </script>

Once embedded, the Player API can be used to control the Player. Let’s say, you want to begin playback from 30 seconds into the video. It can be achieved with the following snippet.

  const player = VideoKenPlayer({
      container: document.getElementById("myvideo"),
      video_id: "vken-1PUjgtAam1T"
  });

  player.on("ready", () => {
    player.seek(30);
    player.play();
  });

You can play with the Player API of the above video using the browser console. The player object named player is available in the document scope.

If you don’t want access to the player API, you can use an iframe embed which is easier. The code for an iframe embed is given below

<iframe src="https://player.videoken.com/embed/vken-1PUjgtAam1T" frameborder="0" allowfullscreen allow="autoplay"
width="540" height="270"></iframe>

The video below is embedded using the iframe method.

Link