Here, you'll find basic instructions on how to integrate the Media
Acceleration SDK with THEOplayer version 2.X.
Please be aware that this integration only take effect for
Chrome/Chromium
and that it works by intercepting the XMLHttpRequest API calls.
Furthermore, the Fetch API will not be supported on the integrated
page. It is safe to use the integration in all browsers.
How to
-
Add a <script> tag to your page that points to the minified MASDK
Javascript file. In the example that follows, we point to the latest version of the SDK.
Please note that this has to be placed before the tag loading THEOplayer.
<script src="https://media-acceleration-host.akamaized.net/sdk/js/2.8/theoplayer-v2.min.js"></script>
-
After the MASDK has been loaded, instantiate it with the code below.
Again, this has to be placed before the tag loading THEOplayer.
<script>
let maConfig = {
// add any MA SDK options here
};
var ma = new MediaAccelerationTheoPlayerWrapper(maConfig);
</script>
-
Locate the spot in your code where you are instantiating an instance of the player:
/* Before MASDK integration */
const player = new THEOplayer.Player(element, {});
-
Let the MASDK know about the player instance:
/* After MASDK integration */
const player = new THEOplayer.Player(element, {});
ma.setVideoElement(player);
For a complete example we recommend that you view the source code of this demo page.
SDK Location
The recommended SDK version to use with the supported THEOplayer version 2.X is:
<script src="https://media-acceleration-host.akamaized.net/sdk/js/2.8/theoplayer-v2.min.js"></script>