קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
Google DAI API מאפשר להטמיע שידורים שכוללים DAI מבית Google בסביבות
שבהן אין תמיכה בהטמעה של IMA SDK. אנחנו ממליצים להמשיך להשתמש
IMA בפלטפורמות שבהן יש תמיכה ב-IMA SDK.
אנחנו ממליצים להשתמש ב-DAI API בפלטפורמות הבאות:
Samsung Smart TV (Tizen)
טלוויזיה של LG
HbbTV
Xbox (אפליקציות JavaScript)
KaiOS
ה-API תומך ביכולות הבסיסיות שמסופקות על ידי IMA DAI SDK. עבור
לשאלות ספציפיות על תאימות או תכונות נתמכות, אפשר לפנות אל
הנציג של חשבון Google.
הטמעת DAI API לסטרימינג בשידור חי
DAI API תומך בשידורים לינאריים (LIVE) באמצעות פרוטוקולים HLS ו-DASH.
השלבים המתוארים במדריך הזה חלים על שני הפרוטוקולים.
כדי לשלב את ה-API באפליקציה בשידורים חיים, צריך לבצע את הפעולות הבאות
שלבים:
1. איך מבקשים שידור חי
כדי לבקש שידור חי מ-DAI API, צריך לבצע קריאת POST אל השידור
נקודת הקצה. תגובת ה-JSON מכילה את המניפסט של השידור וגם את השיוך שלו
נקודות קצה וערכים של DAI API.
אם יש שגיאות, מוחזרים קודי שגיאות HTTP רגילים ללא תגובת JSON
גוף ההודעה.
נתח את תגובת ה-JSON ואחסן את הערכים הבאים:
stream_id
אפשר להשתמש בערך הזה כדי לזהות את השידור שהוחזר.
stream_manifest
כתובת ה-URL הזו מועברת לנגן המדיה לצורך הפעלת השידור.
media_verification_url
כתובת ה-URL הזו היא נקודת הקצה הבסיסית למעקב אחר אירועי הפעלה.
metadata_url
כתובת ה-URL הזו משמשת לבדיקת מידע תקופתי לגבי שידורים קרובים
אירועים.
session_update_url
כתובת ה-URL הזו משמשת לעדכון הפרמטרים של הבקשה לשידור חי שנשלחו במהלך
בקשה לשידור בסטרימינג. לתשומת ליבך, הפרמטרים של הבקשה הזו מחליפים את כל הפרמטרים
מוגדר לשידור המוקדם יותר.
polling_frequency
התדירות, בשניות, כשמבקשים מטא-נתונים מעודכנים של AdBreak
DAI API.
2. סקר על מטא-נתונים חדשים של AdBreak
מגדירים טיימר כדי לבדוק מטא-נתונים חדשים של AdBreak בתדירות הדגימה, באמצעות הפונקציה
של מטא-נתונים. אם לא צוין אחרת בתשובה של השידור, ברירת המחדל המומלצת
הוא 10 שניות.
כדי לוודא שאירועים ספציפיים קרו בווידאו בסטרימינג, צריך לפעול לפי השלבים הבאים
שלבים לטיפול באירועי ID3:
אחסון אירועי המדיה בתור, ושמירה של כל מזהה מדיה יחד עם
חותמת זמן (אם הנגן מציג זאת).
בכל פעם עדכון מהנגן, או בתדירות מוגדרת (מומלץ
500 אלפיות השנייה), אפשר לבדוק את התור לאירועי המדיה של אירועים שהופעלו לאחרונה על ידי
השוואה בין חותמות הזמן של האירוע לבין המיקום הנוכחי.
כדי לבדוק אירועי מדיה שהושמעו, אפשר לבדוק את הסוג שלהם
מזהה המדיה בתגי ההפסקות למודעות שנשמרו. חשוב לזכור שהתגים השמורים
מכילים רק קידומת של מזהה המדיה, כך שלא ניתן להשתמש בהתאמה מדויקת.
איך משתמשים ב'התקדמות' אירועים כדי לעקוב אחרי מקרים שבהם משתמש נמצא בהפסקה למודעה.
אל תשלחו את האירועים האלה לנקודת הקצה של אימות המדיה. לאירוע אחר
שונים, מוסיפים את מזהה המדיה לנקודת הקצה של אימות המדיה ומבצעים GET
בקשה למעקב אחר ההפעלה.
Accepted for asynchronous verification - HTTP/1.1 202 Accepted
Successful empty response - HTTP/1.1 204 No Content
Media verification not found - HTTP/1.1 404 Not Found
Media verification sent by someone else - HTTP/1.1 409 Conflict
Successful response would be to look for - HTTP/1.1 200
מגבלות
אם אתם משתמשים ב-API בתוך רכיבי WebView, ההגבלות הבאות חלות בהתאם
לטירגוט:
סוכן משתמש: הפרמטר של סוכן המשתמש מועבר כערך ספציפי לדפדפן
במקום בפלטפורמה הבסיסית.
rdididtype,
is_lat:
מזהה המכשיר לא מועבר כראוי, ולכן מגבילות את היכולות של
בתכונות הבאות:
מכסת תדירות
סבב מודעות ברצף
פילוח וטירגוט של קהל היעד
שיטות מומלצות
חשוב לזכור שנקודת הקצה במטא-נתונים של האינדקסים של השידורים החיים מבוססת על
של תג ה-ID3 התואם. המטרה היא למנוע שימוש
נקודת קצה למטא-נתונים לביצוע פינג מיידי לכל צומתי האימות.
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-08-21 (שעון UTC)."],[[["\u003cp\u003eThe Google DAI API enables dynamic ad insertion in environments where the IMA SDK isn't feasible, offering an alternative for platforms like Samsung Smart TV, LG TV, and others.\u003c/p\u003e\n"],["\u003cp\u003eFor live streams, the API involves requesting a stream, polling for ad metadata, tracking playback events using ID3 cues and media verification URLs, and optionally updating stream session parameters.\u003c/p\u003e\n"],["\u003cp\u003eWhile supporting core IMA DAI functionalities, there are limitations regarding user agent and device ID targeting within webviews, potentially affecting frequency capping and audience segmentation.\u003c/p\u003e\n"],["\u003cp\u003eAd metadata retrieval is optimized using ID3 tag prefixes for indexing, and detailed API documentation, samples, and resources are available for further implementation guidance.\u003c/p\u003e\n"]]],[],null,["# Manage DAI livestreams\n\nThe Google DAI API lets you implement Google DAI-enabled streams in environments\nwhere implementing the IMA SDK is not supported. We recommend that you still use\nIMA on platforms where the IMA SDK is supported.\n\nWe recommend using the DAI API on the following platforms:\n\n- Samsung Smart TV (Tizen)\n- LG TV\n- HbbTV\n- Xbox (JavaScript apps)\n- KaiOS\n\nThe API supports the basic capabilities provided by the IMA DAI SDK. For\nspecific questions about compatibility or supported features, reach out to\nyour Google account manager.\n\nImplement the DAI API for LIVE streams\n--------------------------------------\n\nThe DAI API supports linear (LIVE) streams using both HLS and DASH protocols.\nThe steps described in this guide apply to both protocols.\n\nTo integrate the API into your app for LIVE streams, complete the following\nsteps:\n\n### 1. Request a stream\n\nTo request a livestream from the DAI API, make a POST call to the stream\nendpoint. The JSON response contains the stream manifest as well as associated\nDAI API endpoints and values.\n\n#### Example request body\n\n https://dai.google.com/linear/v1/dash/event/0ndl1dJcRmKDUPxTRjvdog/stream\n\n {\n key1 : \"value1\",\n stream_parameter1 : \"value2\"\n }\n\n| **Note:** `api_key` can be supplied using the `Authorization` HTTP header.\n\n#### Example response body\n\n {\n \"stream_id\":\"c6bbee18-0d20-4c55-b071-efdf3a81da33:ATL\",\n \"stream_manifest\":\"https://dai.google.com/linear/dash/pa/event/0ndl1dJcRmKDUPxTRjvdog/stream/c6bbee18-0d20-4c55-b071-efdf3a81da33:ATL/manifest.mpd\",\n \"media_verification_url\":\"https://dai.google.com/view/p/service/linear/stream/c6bbee18-0d20-4c55-b071-efdf3a81da33:ATL/loc/ATL/network/51636543/event/0ndl1dJcRmKDUPxTRjvdog/media/\",\n \"metadata_url\":\"https://dai.google.com/linear/v1/pa/event/0ndl1dJcRmKDUPxTRjvdog/stream/c6bbee18-0d20-4c55-b071-efdf3a81da33:ATL/metadata\",\n \"session_update_url\":\"https://dai.google.com/linear/v1/pa/event/0ndl1dJcRmKDUPxTRjvdog/stream/c6bbee18-0d20-4c55-b071-efdf3a81da33:ATL/session\",\n \"polling_frequency\":10\n }\n\n#### Error response\n\nIn case of errors, standard HTTP error codes are returned with no JSON response\nbody.\n\nParse the JSON response and store the following values:\n\nstream_id\n: This value can be used to identify the returned stream.\n\nstream_manifest\n: This URL is passed to your media player for stream playback.\n\nmedia_verification_url\n: This URL is the base endpoint for tracking playback events.\n\nmetadata_url\n: This URL is used to poll for periodic information about upcoming stream\n events.\n\nsession_update_url\n: This URL is used to update stream request parameters sent during the initial\n stream request. Note that the parameters of this request replace all parameters\n set for the earlier stream.\n\npolling_frequency\n: The frequency, in seconds, when requesting updated AdBreak Metadata from the\n DAI API.\n\n### 2. Poll for new AdBreak Metadata\n\nSet a timer to poll for new AdBreak Metadata at the polling frequency, using the\nmetadata URL. If not specified in the stream response, the default recommended\ninterval is 10 seconds.\n\n#### Example request body\n\n https://dai.google.com/linear/v1/pa/event/0ndl1dJcRmKDUPxTRjvdog/stream/c6bbee18-0d20-4c55-b071-efdf3a81da33:ATL/metadata\n\n#### Example response body\n\n {\n \"tags\":{\n \"google_0492266569\":{\n \"ad\":\"0000229836_ad1\",\n \"ad_break_id\":\"0000229836\",\n \"type\":\"firstquartile\"\n },\n \"google_1560331148\":{\n \"ad\":\"0000229836_ad1\",\n \"ad_break_id\":\"0000229836\",\n \"type\":\"thirdquartile\"\n },\n \"google_1877686714378797835\":{\n \"ad\":\"0000229836_slate\",\n \"ad_break_id\":\"0000229836\",\n \"type\":\"progress\"\n },\n \"google_1vRyQBYPw_7Gg3MrZ6S5EjmV9aLje-YpW8QHed1DSlU\":{\n \"ad\":\"0000229835_ad1\",\n \"ad_break_id\":\"0000229835\",\n \"type\":\"progress\"\n },\n \"google_2032765498\":{\n \"ad\":\"0000229835_ad1\",\n \"ad_break_id\":\"0000229835\",\n \"type\":\"midpoint\"\n },......\n \"google_5646900623\":{\n \"ad\":\"0000229837_ad1\",\n \"ad_break_id\":\"0000229837\",\n \"type\":\"complete\"\n }\n },\n \"ads\":{\n \"0000229834_ad1\":{\n \"ad_break_id\":\"0000229834\",\n \"position\":1,\n \"duration\":15.01,\n \"title\":\"truman-e2e-creativeset4\",\n \"description\":\"truman-e2e-creativeset4 ad\",\n \"ad_system\":\"GDFP\",\n \"ad_id\":\"39066884\",\n \"creative_id\":\"58092079124\",\n \"clickthrough_url\":\"https://pubads.g.doubleclick.net/pcs/click?xai=AKAO...\\u0026adurl=http://google.com\",\n \"universal_ad_id\":{\n \"id_value\":\"58092079124\",\n \"id_registry\":\"GDFP\"\n }\n },\n \"0000229834_slate\":{\n \"ad_break_id\":\"0000229834\",\n \"position\":-1,\n \"duration\":14.974977777,\n \"slate\":true\n },...\n },\n \"ad_breaks\":{\n \"0000229834\":{\n \"type\":\"mid\",\n \"duration\":15.01,\n \"expected_duration\":29.984977776999997,\n \"ads\":1\n },....\n }\n }\n\n### 3. Listen to ID3 events and track playback events\n\nTo verify that specific events have occurred in a video stream, follow these\nsteps to handle ID3 events:\n\n1. Store the media events in a queue, saving each media ID along with its timestamp (if surfaced by the player).\n2. On each time update from the player, or at a set frequency (recommended 500 ms), check the media events queue for recently played events by comparing the event timestamps to the playhead.\n3. For media events that you confirm have played, check the type by looking up the media ID in the stored ad break tags. Keep in mind that the stored tags only contain a prefix of the media ID so an exact match isn't possible.\n4. Use \"progress\" events to keep track of whether a user is inside an ad break. Don't send these events to the media verification endpoint. For other event types, append the media ID to the media verification endpoint and make a GET request to track playback.\n5. Remove the media event from the queue.\n\n#### Example request body\n\n https://dai.google.com/view/p/service/linear/stream/c6bbee18-0d20-4c55-b071-efdf3a81da33:ATL/loc/ATL/network/51636543/event/0ndl1dJcRmKDUPxTRjvdog/media/\n\n#### Example responses\n\n Accepted for asynchronous verification - HTTP/1.1 202 Accepted\n Successful empty response - HTTP/1.1 204 No Content\n Media verification not found - HTTP/1.1 404 Not Found\n Media verification sent by someone else - HTTP/1.1 409 Conflict\n\nYou can verify tracking events in [Stream Activity\nMonitor](//support.google.com/admanager/answer/7009058).\n\n### 4. Update livestream session parameters\n\nYou might want to adjust your session parameters after a stream has been\ncreated. To do so, make a request to the session update URL.\n| **Warning:** This call overwrites all the existing stream parameters, so your request body must contain all relevant key-value pairs, not just those which have changed.\n\n#### Example request body\n\n https://dai.google.com/linear/v1/pa/event/0ndl1dJcRmKDUPxTRjvdog/stream/c6bbee18-0d20-4c55-b071-efdf3a81da33:ATL/session\n\n {\n key1 : \"value1\",\n stream_parameter1 : \"value2\"\n }\n\n#### Example response body\n\n Successful response would be to look for - HTTP/1.1 200\n\nLimitations\n-----------\n\nIf using the API within webviews, the following limitations apply with respect\nto targeting:\n\n- UserAgent: The user agent parameter is passed as browser specific value instead of the underlying platform.\n- [`rdid`](//support.google.com/admanager/answer/7320899), [`idtype`](//support.google.com/admanager/answer/7320899), [`is_lat`](//support.google.com/admanager/answer/7320899): The device ID is not properly passed, which limits the capabilities of the following features:\n - Frequency capping\n - Sequential ad rotation\n - Audience segmentation and targeting\n\nBest practices\n--------------\n\nKeep in mind that the metadata endpoint for livestream indexes is based on the\nprefix of the corresponding ID3 tag. This is by design to prevent the use of the\nmetadata endpoint for immediately pinging all of the verification nodes.\n\nAdditional resources\n--------------------\n\n- [API reference\n documentation](/ad-manager/dynamic-ad-insertion/api/full-service/reference/live)\n- [Simple\n sample](//github.com/googleads/googleads-dynamic-ad-insertion/tree/master/simple/Live)\n- [IMA SDK documentation](/interactive-media-ads)\n- [DAI layer implementation types\n comparison](//support.google.com/admanager/answer/9840889)"]]