حفظ الإشارات المرجعية لبث الإعلانات وتحميلها
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يوضِّح هذا الدليل كيفية تطبيق الإشارات المرجعية باستخدام حزمة تطوير البرامج لإدراج إعلان ديناميكي لإعلانات الوسائط التفاعلية.
عند استخدام ميزة "إدراج إعلان ديناميكي" (DAI) في فيديوهات البث عند الطلب
وهذا يفترض تنفيذ إدراج إعلان ديناميكي لإعلانات الوسائط التفاعلية، مثل ما يتم عرضه في
البدء
ما هي الإشارات المرجعية؟
الإشارة المرجعية هي القدرة على الحفظ ثم العودة إلى نقطة محددة
في تدفق المحتوى. لنفترض أن أحد المستخدمين يشاهد خمس دقائق من المحتوى،
من بث الفيديو ثم يعود إليه يؤدي وضع إشارة مرجعية إلى حفظ
موضع المستخدم في ساحة المشاركات لكي يتمكن البث من المضي قدمًا
لتوفير تجربة سلسة للمشاهد.
الخيارات المتقدمة لإضافة إشارات مرجعية إلى "إدراج إعلان ديناميكي"
عند وضع إشارة مرجعية على بث DAI، عليك تسجيل معرّف البث ووقته.
عندما يغادر المستخدم الفيديو عندما يعود المستخدم، اطلب
للبث والاستفادة من الوقت الذي تم توفيره. نظرًا لأن كل مثيل مطلوب
يمكن أن يتضمّن البث فواصل إعلانية لفترات مختلفة، ما يؤدي ببساطة إلى حفظ البث.
لن يعمل الوقت. ما تريد القيام به حقًا هو المتابعة من نفس
وقت المحتوى.
طرق التحويل للإنقاذ
توفِّر حزمة تطوير البرامج لإدراج إعلان ديناميكي لإعلانات الوسائط التفاعلية طريقتَين لطلب وقت المحتوى.
لوقت البث ووقت البث لمحتوى معيّن
الوقت. باستخدام طرق التحويل هذه، يمكنك تخزين علامات
وقت المحتوى ثم الانتقال إلى وقت البث المقابل في
المثيل الجديد للبث. إليك النهج، بما في ذلك رابط
إلى نموذج تطبيق يعرض عملية تنفيذ لإشارات مرجعية.
جارٍ حفظ الإشارات المرجعية
حفظ إشارة مرجعية عندما يكون "النشاط" متوقفًا مؤقتًا
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.contentPlayer pause];
// Ignore this if you're presenting a modal view (e.g. in-app clickthrough).
if ([self.navigationController.viewControllers indexOfObject:self] ==
NSNotFound) {
NSTimeInterval contentTime =
[self.streamManager contentTimeForStreamTime:CMTimeGetSeconds(
self.contentPlayer.currentTime)];
self.video.savedTime = contentTime;
...
}
}
}
جارٍ تحميل الإشارات المرجعية
تحميل الإشارة المرجعية عند إعادة طلب ساحة مشاركات إنه جزء من تنفيذ
الواجهة VideoStreamPlayer
.
- (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdEvent:(IMAAdEvent *)event {
...
case kIMAAdEvent_STREAM_LOADED: {
if (self.video.savedTime > 0) {
NSTimeInterval streamTime =
[self.streamManager streamTimeForContentTime:self.video.savedTime];
[self.IMAVideoDisplay.playerItem
seekToTime:CMTimeMakeWithSeconds(streamTime, NSEC_PER_SEC)];
self.video.savedTime = 0;
}
}
}
نموذج تطبيق
نموذج تطبيق
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-21 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-21 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThis guide explains how to implement bookmarking in video-on-demand (VOD) streams using the IMA DAI SDK for a seamless viewing experience.\u003c/p\u003e\n"],["\u003cp\u003eBookmarking involves saving the user's content time, not just the stream time, to ensure accurate resumption upon return.\u003c/p\u003e\n"],["\u003cp\u003eThe IMA DAI SDK provides methods to convert between stream time and content time, which are crucial for bookmarking functionality.\u003c/p\u003e\n"],["\u003cp\u003eSaving bookmarks involves recording the content time when the user pauses the video, while loading bookmarks requires seeking to the corresponding stream time in the new stream instance.\u003c/p\u003e\n"],["\u003cp\u003eA sample app demonstrating bookmarking implementation is available on GitHub.\u003c/p\u003e\n"]]],["Bookmarking in Dynamic Ad Insertion (DAI) involves saving a user's position in a video stream and resuming from that point. Instead of saving stream time, the system records the content time using conversion methods provided by the IMA DAI SDK. When the user leaves, the content time is saved. Upon return, the saved content time is used to calculate the new stream time, allowing seeking to the correct point in the stream. The process is demonstrated with sample code and a provided sample application.\n"],null,["# Save and load ad stream bookmarks\n\nThis guide shows how to implement bookmarking using the IMA DAI SDK\nwhen using Dynamic Ad Insertion (DAI) for video-on-demand (VOD) streams.\nThis assumes a working IMA DAI implementation, such as the one presented in\n\n\n[Get Started](/interactive-media-ads/docs/sdks/ios/dai-quickstart).\n\n\nWhat is bookmarking?\n--------------------\n\nBookmarking is the ability to save and then return to a specific point\nin the content stream. Suppose a user watches five minutes of content,\nleaves the video stream, and then returns to it. Bookmarking saves the\nuser's position in the stream so the stream can pick up from where it\nleft off, providing a seamless experience to the viewer.\n\nDAI bookmarking under the hood\n------------------------------\n\nWhen bookmarking a DAI stream, you must record the stream id and time\nwhen the user leaves the video. When the user returns, re-request the\nstream and seek to the saved time. Since each instance of the requested\nstream can have ad breaks of different durations simply saving the stream\ntime won't work. What you really want to do is continue from the same\n**content time**.\n\nConversion methods to the rescue\n--------------------------------\n\nThe IMA DAI SDK provides a pair of methods to request the **content time**\nfor a given **stream time** and the **stream time** for a given **content\ntime** . Using these conversion methods you can store the bookmarked\n**content time** and then seek to the corresponding **stream time** in\nthe new instance of the stream. Here's the approach, including a link\nto a sample app that shows a working bookmarking implementation.\n\nSaving bookmarks\n----------------\n\nSave a bookmark when the Activity is paused. \n\n - (void)viewWillDisappear:(BOOL)animated {\n [super viewWillDisappear:animated];\n [self.contentPlayer pause];\n // Ignore this if you're presenting a modal view (e.g. in-app clickthrough).\n if ([self.navigationController.viewControllers indexOfObject:self] ==\n NSNotFound) {\n NSTimeInterval contentTime =\n [self.streamManager contentTimeForStreamTime:CMTimeGetSeconds(\n self.contentPlayer.currentTime)];\n self.video.savedTime = contentTime;\n ...\n }\n }\n }\n\nLoading bookmarks\n-----------------\n\nLoad the bookmark when re-requesting a stream. It's part of implementing\nthe `VideoStreamPlayer` interface. \n\n - (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdEvent:(IMAAdEvent *)event {\n ...\n case kIMAAdEvent_STREAM_LOADED: {\n if (self.video.savedTime \u003e 0) {\n NSTimeInterval streamTime =\n [self.streamManager streamTimeForContentTime:self.video.savedTime];\n [self.IMAVideoDisplay.playerItem\n seekToTime:CMTimeMakeWithSeconds(streamTime, NSEC_PER_SEC)];\n self.video.savedTime = 0;\n }\n }\n }\n\nSample app\n----------\n\n[Sample app](//github.com/googleads/googleads-ima-ios-dai)"]]