طلب بث الفيديوهات عند الطلب باستخدام ميزة "إدراج إعلان ديناميكي"
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
من خلال Google DAI API، يمكنك الاستفادة من ميزة "إدراج إعلان ديناميكي" من Google في مختلف البيئات.
حيث لا يكون تنفيذ حزمة تطوير البرامج لإعلانات الوسائط التفاعلية متاحًا ننصحك بمواصلة استخدام
إعلانات الوسائط التفاعلية على الأنظمة الأساسية التي تتيح استخدام حزمة تطوير البرامج لإعلانات الوسائط التفاعلية
ننصحك باستخدام DAI API على المنصّات التالية:
تلفزيون Samsung الذكي (Tizen)
تلفزيون LG
HbbTV
Xbox (تطبيقات JavaScript)
KaiOS
تتوافق واجهة برمجة التطبيقات مع الميزات الأساسية التي تقدّمها حزمة تطوير البرامج لإدراج إعلان ديناميكي لإعلانات الوسائط التفاعلية. بالنسبة إلى
أسئلة حول التوافق أو الميزات المتاحة، يُرجى التواصل مع فريق
مدير الحساب.
تنفيذ DAI API لأحداث البث عند الطلب
تتيح DAI API بث الفيديوهات عند الطلب باستخدام بروتوكولَي HLS وDASH. الخطوات
كما هو موضح في هذا الدليل، على كِلا البروتوكولين.
لدمج واجهة برمجة التطبيقات في تطبيقك لبثّ الفيديوهات عند الطلب، أكمِل
الخطوات التالية:
يمكنك طلب بث من خلال إجراء طلب POST لنقطة نهاية البث:
في حال حدوث أخطاء، يتم عرض رموز خطأ HTTP العادية بدون JSON.
نص الاستجابة.
حلِّل استجابة JSON واحتفِظ بالقيم التالية:
stream_id
stream_manifest
media_verification_url
ad_breaks
للتحقّق من الوسائط، يُرجى الانتباه إلى أحداث رقم التعريف 3:
يمكنك تخزين أحداث الوسائط في قائمة انتظار، وحفظ كل معرف وسائط مع
الطابع الزمني (في حال عرضه مشغّل الفيديو)
عند التحديث في كل مرة من المشغّل أو بمعدّل تكرار محدّد (يُنصح به)
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
اختياري: استخدام بيانات ad_breaks من مصدر البيانات لإنشاء رد للبحث
لتحديد نوع الحدث الذي تم تنشيطه.
إزالة حدث الوسائط من قائمة الانتظار
القيود
في حال استخدام واجهة برمجة التطبيقات في مكتبات WebView، تنطبق القيود التالية في ما يتعلق
إلى الاستهداف:
UserAgent: يتم ضبط معلَمة وكيل المستخدم كقيمة خاصة بالمتصفّح.
بدلاً من المنصة الأساسية
rdid،
idtype,
is_lat: رقم تعريف الجهاز هو
لا يتم تجاوزها بشكل صحيح، مما يحد من الميزات التالية:
تحديد عدد مرات الظهور
العرض المتسلسل للإعلانات بالتناوب
تقسيم الجمهور واستهدافه
أفضل الممارسات
إنّ ربط علامات ID3 بنوع الحدث المناسب أمر مملاً في الفيديوهات عند الطلب. يمكنك استخدام
عرض معلومات ad_breaks في ملف JSON للبحث عن الحدث مباشرةً، مثل
تفعلها مع المحتوى المباشر.
تاريخ التعديل الأخير: 2025-08-21 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-21 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Google DAI API enables Google DAI streams on platforms where the IMA SDK isn't supported, but IMA is still recommended where it's available.\u003c/p\u003e\n"],["\u003cp\u003eThe DAI API, supporting VOD streams with HLS and DASH protocols, is recommended for platforms like Samsung Smart TV, LG TV, HbbTV, Xbox (Javascript apps), and KaiOS.\u003c/p\u003e\n"],["\u003cp\u003eImplementing the DAI API involves requesting a stream, parsing the response, performing media verification using ID3 events, and optionally utilizing \u003ccode\u003ead_breaks\u003c/code\u003e data for event lookup.\u003c/p\u003e\n"],["\u003cp\u003eWhile using the API in webviews has limitations affecting targeting and device ID passing, it's best practice to utilize \u003ccode\u003ead_breaks\u003c/code\u003e data for event identification in VOD.\u003c/p\u003e\n"]]],[],null,["# Request DAI VOD streams\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 features provided by the IMA DAI SDK. For specific\nquestions about compatibility or supported features, reach out to your Google\naccount manager.\n\nImplement the DAI API for VOD streams\n-------------------------------------\n\nThe DAI API supports VOD streams using both HLS and DASH protocols. The steps\ndescribed in this guide apply to both protocols.\n\nTo integrate the API into your application for VOD streams, complete the\nfollowing steps:\n\n1. Request a stream by making a POST call to the stream endpoint:\n\n **Example request body:** \n\n https://dai.google.com/ondemand/v1/dash/content/2559737/vid/tos-dash/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\":\"d32f8920-612a-4d46-8bc7-d73fd6c17c85\",\n \"total_duration\":636.458,\n \"content_duration\":596.458,\n \"valid_for\":\"8h0m0s\",\n \"valid_until\":\"2020-06-04T20:39:41.274707306-07:00\",\n \"stream_manifest\":\"https://dai.google.com/ondemand/dash/content/2559737/vid/tos-dash/ATL/streams/d32f8920-612a-4d46-8bc7-d73fd6c17c85/manifest.mpd\",\n \"media_verification_url\":\"https://dai.google.com/view/p/service/vod/stream/d32f8920-612a-4d46-8bc7-d73fd6c17c85/loc/ATL/network/124319096/content/2559737/vid/tos-dash/media/\",\n \"ad_breaks\":[\n {\n \"type\":\"pre\",\n \"start\":0,\n \"duration\":10,\n \"ads\":[\n {\n \"seq\":1,\n \"duration\":10,\n \"title\":\"External NCA1C1L1 Preroll\",\n \"description\":\"External NCA1C1L1 Preroll ad\",\n \"clickthrough_url\":\"https://dai.google.com/ondemand/v1/dash/content/2474148/vid/bbb-clear/location/ATL/stream/d32f8920-612a-4d46-8bc7-d73fd6c17c85/videoclick/5489259204425938365\",\n \"events\":[\n {\n \"time\":0.1,\n \"type\":\"start\"\n },\n {\n \"time\":2.5,\n \"type\":\"firstquartile\"\n },\n {\n \"time\":4.75,\n \"type\":\"midpoint\"\n },\n {\n \"time\":7.5,\n \"type\":\"thirdquartile\"\n },\n {\n \"time\":9,\n \"type\":\"complete\"\n }\n ]\n }\n ]\n },\n {\n \"type\":\"mid\",\n \"start\":45,\n \"duration\":10,\n \"ads\":[\n {.... }\n ]\n }\n ]\n },\n {\n \"type\":\"post\",\n \"start\":626.458,\n \"duration\":10,\n \"ads\":[...]\n }\n ]\n }\n\n **Error Response**\n\n In case of errors, standard HTTP error codes are returned with no JSON\n response body.\n2. Parse the JSON response and store the following values:\n\n - `stream_id`\n - `stream_manifest`\n - `media_verification_url`\n - `ad_breaks`\n3. To perform media verification, listen for ID3 events:\n\n 1. Store the media events in a queue, saving each media ID along with its timestamp (if surfaced by the player).\n 2. On each time update from the player, or at a set frequency (recommended 500ms), check the media events queue for recently played events by comparing the event timestamps to the playhead.\n 3. For media events that you confirm have played, track the playback by appending the media ID to the media verification endpoint and making a GET request.\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\n You can verify tracking events in [Stream Activity\n Monitor](//support.google.com/admanager/answer/7009058).\n4. Optional: Use the `ad_breaks` data from the stream create response to look\n up what type of event was fired.\n\n5. Remove the media event from the queue.\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 following features:\n - Frequency capping\n - Sequential ad rotation\n - Audience segmentation and targeting\n\nBest practices\n--------------\n\nMapping ID3 tags to the appropriate event type is tedious on VOD. Use the\nreturned `ad_breaks` information in the JSON to look up the event directly, like\nyou would with live content.\n\nAdditional resources\n--------------------\n\n- [API reference\n documentation](/ad-manager/dynamic-ad-insertion/api/full-service/reference/vod)\n- [Simple sample](//github.com/googleads/googleads-dynamic-ad-insertion/tree/master/simple/VOD)\n- [IMA SDK documentation](/interactive-media-ads)\n- [DAI layer implementation types comparison](//support.google.com/admanager/answer/9840889)"]]