مدیریت فراداده های زمان بندی شده در جریان های DAI خطی
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
کیت توسعه نرمافزار (DAI) درج آگهی پویا تبلیغات رسانهای تعاملی (IMA) به اطلاعات فراداده تعبیهشده در بخشهای رسانه جریان (فراداده درون باند)، یا در فایل مانیفست جریان (فراداده درون آشکار) برای ردیابی موقعیت بینندگان و مشتری متکی است. رویدادهای تبلیغاتی جانبی متادیتا از جریان DAI در قالب های مختلف بسته به نوع جریان در حال پخش در دسترس است. IMA DAI SDK همه فرمتهای فراداده را از طریق یک API مدیریت میکند.
برنامه شما مسئول گرفتن فراداده و ارسال آن به IMA DAI SDK است. SDK متد StreamManager.onMessage()
را برای انتقال این اطلاعات ارائه می دهد. این روش ابرداده را در قالب یک شیء msg
ارائه شده توسط پورت roVideo ارسال می کند. سپس این اشیاء توسط IMA DAI SDK پردازش میشوند تا زمانبندی رویدادهای تبلیغاتی مشخص شود. به یک استدلال واحد نیاز دارد:
-
msg
: یک شی از نوع پیام ارائه شده توسط پورت roVideo.
در اینجا مثالی از نحوه مدیریت ابرداده از پورت roVideo و ارسال آن به IMA DAI SDK از طریق StreamManager.onMessage()
آورده شده است.
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
جریانهای خطی DAI HLS با استفاده از چارچوب برنامه کاربردی رسانه مشترک (CMAF) ابردادههای زمانبندیشده را از طریق جعبههای eMSGv1 درون باند به دنبال استاندارد ID3 تا CMAF منتقل میکنند. این جعبههای eMSG در ابتدای هر بخش رسانه تعبیه شدهاند و هر ID3 eMSG حاوی یک PTS نسبت به آخرین ناپیوستگی در جریان است.
برای IMA Roku، همه جریانهای HLS CMAF دادههای ID3 درون باند را با استفاده از قالب eMSGv0 ارسال میکنند. IMA اطلاعات ارائه شده توسط فرمت eMSGv0 را با اطلاعات شی ویدیو ترکیب می کند.
برای فعال کردن تجزیه مناسب رویدادهای ID3 جریان HLS CMAF، باید شی ویدیوی خود را در درخواست جریان با استفاده از StreamRequest.videoObject
ارسال کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-21 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-21 بهوقت ساعت هماهنگ جهانی."],[[["\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)."]]