AI-generated Key Takeaways
-
The CAF DAI SDK works with CAF Ad Breaks, so use CAF Ad Break events for most logging or custom functionality.
-
The CAF DAI SDK provides additional events not available through CAF Ad Breaks, such as quartile tracking.
-
Publishers needing full parity with IMA DAI SDK platforms may need to use StreamManager event listeners for these extra events.
-
You can forward these additional events to sender apps using
castContext.sendCustomMessage().
The CAF DAI SDK integrates closely with the native CAF Ad Breaks functionality. As such, in most cases, you should use CAF Ad Break events to trigger logging or custom functionality. However, the CAF DAI SDK offers several additional events that are not available directly through CAF Ad Breaks, such as quartile tracking events.
Publishers who want full parity with platforms using the IMA DAI SDK may need to attach event listeners to the StreamManager to handle these additional events. If it is necessary to pass these events on to the attached sender apps, simply forward the event to the sender via castContext.sendCustomMessage().
Example:
...
streamManager.addEventListener(ima.cast.dai.api.StreamEvent.Type.MIDPOINT, (event) => {
// add custom receiver handler code here, if necessary
console.log(event);
// broadcast event to all attached senders, so they can
// run custom handler code, if necessary
const CUSTOM_CHANNEL = 'urn:x-cast:com.example.cast.mynamespace';
castContext.sendCustomMessage(CUSTOM_CHANNEL, null, event);
});
castContext.start();
...