cdk-std
The cdk-std
is the standard library for development with Mixer Interactive controls. It provides foundational functionality to communicate from your controls to the Mixer webpage. If you're using the Preact starter, this library is already largely wrapped up for you. If you're using the HTML starter code, you'll be dealing with this more directly.
Usage & Documentation
API documentation is available here.
We recommend importing this script through our CDN by adding a script tag in the <head>
of your webpage:
<script src="https://mixercc.azureedge.net/lib/std-v0.2.js"></script>
After importing it, mixer
will be available as a global variable in your code. To send input, for example, you can call:
document.getElementById('hello-world').onclick = function(event) {
mixer.socket.call('giveInput', {
controlID: 'hello-world',
event: 'click',
button: event.button,
});
};
For more information, head to our developer site!
Why is this needed?
For security reasons, all custom control code you write runs in a sandboxes iframe in the Mixer page. However, there's information we want to tell you about, such as the data coming down the Interactive websocket, the position of the video, and so on and so forth. This package provides a bridge and pleasant wrappers over postMessage, the protocol that allows that to happen.
β
ββββββββββββββββ ββββββββββββββββ
βMixer webpage β β β Your Custom β
β or app β β Controls β
β ββββ΄ββββ΄ββββ΄βββ β
β βββ€ cdk-std βββΆ β
β ββββ¬ββββ¬ββββ¬βββ β
ββββββββββββββββ ββββββββββββββββ
β
Frame boundary