고급 IMA 이벤트 수신
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
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 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();
...
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-21(UTC)
[null,null,["최종 업데이트: 2025-08-21(UTC)"],[[["\u003cp\u003eThe CAF DAI SDK leverages CAF Ad Break events for logging and custom functionality, recommending their use over separate implementations.\u003c/p\u003e\n"],["\u003cp\u003eFor advanced use cases like quartile tracking, the CAF DAI SDK provides additional StreamEvents beyond standard CAF Ad Break events.\u003c/p\u003e\n"],["\u003cp\u003eTo ensure sender application compatibility, publishers can utilize \u003ccode\u003ecastContext.sendCustomMessage()\u003c/code\u003e to relay custom CAF DAI events to sender applications.\u003c/p\u003e\n"]]],["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"],null,["# Listen for advanced IMA events\n\nThe CAF DAI SDK integrates closely with the native [CAF Ad Breaks](/cast/docs/web_sender/advanced#ad_breaks) functionality. As such, in most cases, you should use [CAF Ad Break events](/cast/docs/web_receiver/ad_breaks#events) to trigger logging or custom functionality. However, the CAF DAI SDK offers [several additional events](/ad-manager/dynamic-ad-insertion/sdk/cast/reference/js/StreamEvent#enumeration) that are not available directly through CAF Ad Breaks, such as quartile tracking events.\n\nPublishers 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()](/cast/docs/reference/web_receiver/cast.framework.CastReceiverContext#sendCustomMessage).\n\n**Example:** \n\n ...\n\n streamManager.addEventListener(ima.cast.dai.api.StreamEvent.Type.MIDPOINT, (event) =\\\u003e {\n // add custom receiver handler code here, if necessary\n console.log(event);\n // broadcast event to all attached senders, so they can\n // run custom handler code, if necessary\n const CUSTOM_CHANNEL = 'urn:x-cast:com.example.cast.mynamespace';\n castContext.sendCustomMessage(CUSTOM_CHANNEL, null, event);\n });\n\n castContext.start();\n\n ..."]]