CAF DAI SDK 與原生 CAF 廣告插播功能緊密整合。因此在多數情況下,您應該使用 CAF 廣告插播事件來觸發記錄或自訂功能。不過,CAF DAI SDK 提供無法直接透過 CAF 廣告插播提供的其他事件,例如四分位數追蹤事件。
發布商如果希望與使用 IMA DAI SDK 的平台完全一致,可能需要將事件監聽器附加至 StreamManager 以處理這些額外事件。如需將這些事件傳送至附加的傳送端應用程式,只要透過 castContext.sendCustomMessage() 將事件轉寄給傳送者即可。
範例:
...streamManager.addEventListener(ima.cast.dai.api.StreamEvent.Type.MIDPOINT,(event)=>{// add custom receiver handler code here, if necessaryconsole.log(event);// broadcast event to all attached senders, so they can// run custom handler code, if necessaryconstCUSTOM_CHANNEL='urn:x-cast:com.example.cast.mynamespace';castContext.sendCustomMessage(CUSTOM_CHANNEL,null,event);});castContext.start();...
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-21 (世界標準時間)。"],[],["The CAF DAI SDK utilizes CAF Ad Break events for most functions, but it also provides additional events like quartile tracking. Publishers needing full parity with the IMA DAI SDK should attach event listeners to the StreamManager to handle these extra events. To pass these events to sender apps, use `castContext.sendCustomMessage()`. An example shows how to add a listener for the `MIDPOINT` event, log it, and then broadcast it to all connected senders via a custom message channel.\n"]]