Creating the player
The player can be integrated by hosting the following lines of HTML on an HTTP server. This procedure is described on a step-by-step basis, to add all the code in one go, see the Completed code below. For more information about the code, see Code details.
Unzip the opy-sdk-js-5.19.x-integration.zip / opy-sdk-js-5.19.x-integration-no-ui.zip and host the following files where they will be accessible to the HTML page you are creating.
opy-sdk-js-all-integration.js / opy-sdk-js-all-no-ui-integration.js
opy-sdk-js.css
On your website or
localhost
environment, host the following snippet of HTML:XML<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> </head> <body> <div style="width: 80%;margin:auto"></div> </body> </html>
Link the HTML to the SDK by inserting the script and CSS references into the
<head>
section:XML<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <script src="opy-sdk-js-all-integration.js"></script> <link rel="stylesheet" href="opy-sdk-js.css" /> </head>
Insert the
<video>
tag into the<body>
of your HTML.XML<body> <div style="width: 80%;margin:auto"> <video class="video-js vjs-default-skin vjs-16-9" id="videoPlayer" controls crossorigin="anonymous" ></video> </div> </body>
Configure the player with the URL of the content to be played by adding the following JavaScript inside a
<script></script>
tag pair within the<body>
:JS<script> document.addEventListener("DOMContentLoaded", () => { const playerInstance = otvplayer( "videoPlayer", { plugins: { otvtoolkit: { } } }, () => { playerInstance.src({ src: "https://d3bqrzf9w11pn3.cloudfront.net/basic_dash_bbb_clear/bbb_public.mpd", type: "application/dash+xml" }); } ); }); </script>
Navigate to the web page to test the player.
Completed code
Next step: You can now add player features.