선형 DAI 스트림의 시간이 지정된 메타데이터 처리
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
양방향 미디어 광고 (IMA) 동적 광고 삽입 SDK (DAI)는
스트림의 미디어 세그먼트에 삽입된 메타데이터 정보 (대역 내 메타데이터),
스트리밍 매니페스트 파일 (매니페스트 내 메타데이터)에서
위치 및 클라이언트 측 광고 이벤트를 지원합니다. 메타데이터는 DAI 스트림에서 사용할 수 있습니다.
여러 형식으로 표시할 수 있습니다. IMA DAI
SDK는 단일 API를 통해 모든 메타데이터 형식을 처리합니다.
앱은 메타데이터를 캡처하여 IMA DAI SDK에 전달해야 합니다. SDK는
StreamManager.onMessage()
드림
메서드를 사용하여 이 정보를 전달합니다. 이 메서드는
msg
객체입니다. 이러한 객체는
광고 이벤트의 타이밍을 설정합니다. 한 번에
인수:
msg
: roVideo 포트에서 제공하는 메시지 유형 객체입니다.
다음은 roVideo 포트에서 메타데이터를 처리하는 방법과
StreamManager.onMessage()
를 통해 IMA DAI SDK에 전달합니다.
Sub runLoop()
' Forward all timed metadata events to IMA.
m.top.video.timedMetaDataSelectionKeys = ["*"]
' Cycle through all the fields and set listeners.
' IMPORTANT: Failure to listen to the position and timedmetadata fields could
' result in ad impressions not being reported.
m.port = CreateObject("roMessagePort")
fields = m.top.video.getFields()
for each field in fields
m.top.video.observeField(field, m.port)
end for
while True
msg = wait(1000, m.port)
if m.top.video = invalid
print "exiting"
exit while
end if
m.streamManager.onMessage(msg)
currentTime = m.top.video.position
If currentTime > 3 And not m.top.adPlaying
m.top.video.enableTrickPlay = true
End If
end while
End Sub
루프 처리 스트림 메타데이터를 통합하는 방법에 관한 자세한 내용
삽입하고 싶다면
IMA Roku 시작 가이드를 참조하세요. 이
이벤트 리스너와 스트림 시작 섹션
메타데이터 처리 루프가 포함되어 있습니다.
HLS CMAF 스트림
CMAF (Common Media Application Framework) 패스를 사용하는 선형 DAI HLS 스트림
ID3~
CMAF 표준이 있습니다. 이러한 eMSG 상자는
각 미디어 세그먼트의 시작 부분에 삽입되며, 각 ID3 eMSG에는
스트림의 마지막 중단 시점을 기준으로 한 PTS입니다.
IMA Roku의 경우 모든 HLS CMAF 스트림은 eMSGv0 형식을 사용하여 대역 내 ID3 데이터를 전송합니다.
IMA는 eMSGv0 형식으로 제공한 정보와 정보를 결합합니다.
동영상 객체를 생성합니다.
HLS CMAF 스트림 ID3 이벤트의 적절한 파싱을 사용 설정하려면
동영상 객체를 사용하여
StreamRequest.videoObject
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-21(UTC)
[null,null,["최종 업데이트: 2025-08-21(UTC)"],[[["\u003cp\u003eThe IMA DAI SDK uses metadata embedded within media segments or streaming manifests to track viewer positions and ad events, simplifying ad insertion in live and on-demand content.\u003c/p\u003e\n"],["\u003cp\u003eYour app needs to capture metadata from the roVideo port and forward it to the IMA DAI SDK using the \u003ccode\u003eStreamManager.onMessage()\u003c/code\u003e method for proper ad tracking.\u003c/p\u003e\n"],["\u003cp\u003eHLS CMAF streams utilize in-band eMSGv1 boxes following the ID3 through CMAF standard to pass timed metadata for ad cue points.\u003c/p\u003e\n"],["\u003cp\u003eTo ensure accurate parsing of HLS CMAF stream ID3 events, include the video object in the stream request using \u003ccode\u003eStreamRequest.videoObject\u003c/code\u003e.\u003c/p\u003e\n"]]],["The Interactive Media Ads (IMA) Dynamic Ad Insertion SDK uses in-band or in-manifest metadata to track viewer positions and ad events. Apps capture this metadata and use the `StreamManager.onMessage()` method to forward it to the SDK. This method processes `msg` objects from the roVideo port to time ad events. The example shows a loop that observes video fields, forwards timed metadata to IMA via `onMessage()`, and monitors the video's current position. HLS CMAF streams pass timed metadata via in-band eMSGv1 boxes.\n"],null,["# Handle timed metadata in linear DAI streams\n\nThe Interactive Media Ads (IMA) Dynamic Ad Insertion SDK (DAI) relies on\nmetadata information embedded in the stream's media segments (in-band metadata),\nor in the streaming manifest file (in-manifest metadata) to track viewers'\npositions and client-side ad events. Metadata is available from the DAI stream\nin different formats, depending on the type of stream being played. The IMA DAI\nSDK handles all metadata formats through a single API.\n\nYour app is responsible for capturing metadata and forwarding it to the IMA DAI SDK. The SDK offers the\n[`StreamManager.onMessage()`](/ad-manager/dynamic-ad-insertion/sdk/roku/apis#ima.StreamManager.onMessage)\nmethod to pass this information. This method forwards metadata in the form of a\n`msg` object provided by the roVideo port. These objects are then processed by\nthe IMA DAI SDK to establish the timing for ad events. It takes a single\nargument:\n\n- `msg`: a msg type object provided by the roVideo port.\n\nMetadata sample code\n--------------------\n\nHere's an example of how to handle the metadata from the roVideo port and\npass it to the IMA DAI SDK through `StreamManager.onMessage()`. \n\n Sub runLoop()\n ' Forward all timed metadata events to IMA.\n m.top.video.timedMetaDataSelectionKeys = [\"*\"]\n\n ' Cycle through all the fields and set listeners.\n ' IMPORTANT: Failure to listen to the position and timedmetadata fields could\n ' result in ad impressions not being reported.\n m.port = CreateObject(\"roMessagePort\")\n fields = m.top.video.getFields()\n for each field in fields\n m.top.video.observeField(field, m.port)\n end for\n\n while True\n msg = wait(1000, m.port)\n if m.top.video = invalid\n print \"exiting\"\n exit while\n end if\n\n m.streamManager.onMessage(msg)\n currentTime = m.top.video.position\n If currentTime \u003e 3 And not m.top.adPlaying\n m.top.video.enableTrickPlay = true\n End If\n end while\n End Sub\n\nFor more information on how to incorporate the loop handling stream metadata\ninto your app, see the\n[IMA Roku getting started guide](/ad-manager/dynamic-ad-insertion/sdk/roku). The\n[event listener and stream start section](/ad-manager/dynamic-ad-insertion/sdk/roku#add-event-listeners-and-start-the-stream)\nof the guide contains the metadata handling loop.\n\nHLS CMAF streams\n----------------\n\nLinear DAI HLS streams using the Common Media Application Framework (CMAF) pass\ntimed metadata through in-band eMSGv1 boxes following the [ID3 through\nCMAF](//aomediacodec.github.io/id3-emsg/) standard. These eMSG boxes are\nembedded at the beginning of each media segment, with each ID3 eMSG containing\na PTS relative to the last discontinuity in the stream.\n\nFor IMA Roku, all HLS CMAF streams send in-band ID3 data using the eMSGv0 format.\nIMA combines information provided by the eMSGv0 format with information\nfrom the video object.\n\nTo enable proper parsing of HLS CMAF stream ID3 events, you must send your\nvideo object in the stream request using\n[`StreamRequest.videoObject`](/ad-manager/dynamic-ad-insertion/sdk/roku/apis#ima.StreamRequest.videoObject)."]]