고급 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();

...