nexxPLAY
Search…
WebComponent
The nexxPLAY SDK also supports Integration via WebComponents.
After the initialization of the SDK, a WebComponent Class can be registered globally, if the Browser supports these APIs.
The nexxPLAY WebComponent will be integrated into HTML like this:
1
<nexx-play
2
id="player"
3
data-mediaid="12345"
4
data-streamtype="video"
5
data-config='{"disableAds":1}'
6
></nexx-play>
Copied!
The HTML Tag supports the Attributes data-mediaid (necessary), data-streamtype (optional, will be set to "video", if omitted) and an optional data-config Attribute.
The Config Attribute must be a JSON encoded String of an Object, that would serve as Source for a _play.PlayerConfiguration Object.
After the nexxPLAY SDK has been loaded, the Instance can be started as a WebComponent:
1
_play.config.enableWebComponents().then(function(){
2
window.customElements.define("nexx-play",nexxPLAY);
3
}catch(function(){
4
// provider a Fallback
5
});
Copied!
In this Moment, the custom HTML Tag has been registered and will start the nexxPLAY Instance in the given Container. For registering for Events or further Control, the WebComponent Container offers a method to get the _play.PlayerInstance Instance, which runs inside the HTML Container and exposes the regular SDK Methods:
1
let instance = document.getElementById("player").getInstance();
2
let mediaData = instance.getMediaData();
Copied!
Last modified 1yr ago
Copy link