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

...