بازگشت به وقفه تبلیغاتی رد شده، بازگشت به وقفه تبلیغاتی رد شده، بازگشت به وقفه تبلیغاتی رد شده، بازگشت به وقفه تبلیغاتی رد شده
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
بهعنوان یک ناشر ویدیو، ممکن است بخواهید از جستجوی بینندگان خود در تبلیغات میانپول خود جلوگیری کنید. وقتی کاربر به دنبال وقفه تبلیغاتی است، میتوانید او را به ابتدای آن وقفه تبلیغاتی برگردانید و پس از اتمام آن وقفه تبلیغاتی، او را به مکان جستجوی خود برگردانید. این ویژگی "snapback" نام دارد.
به عنوان مثال، نمودار زیر را ببینید. بیننده شما در حال تماشای یک ویدیو است و تصمیم می گیرد از نقطه 5 دقیقه تا 15 دقیقه را جستجو کند. با این حال، یک وقفه تبلیغاتی در حد 10 دقیقه وجود دارد که میخواهید قبل از اینکه بتوانند محتوا را بعد از آن تماشا کنند، آن را تماشا کنند:

برای نمایش این استراحت تبلیغاتی، مراحل زیر را انجام دهید:
- بررسی کنید که آیا کاربر جستجویی انجام داده است که از یک وقفه تبلیغاتی تماشا نشده عبور کرده است یا خیر، و اگر چنین است، او را به استراحت تبلیغاتی برگردانید.
- پس از اتمام وقفه تبلیغاتی، آنها را به جستجوی اصلی خود برگردانید.
در شکل نمودار، به شکل زیر است:

در اینجا نحوه پیاده سازی snapack با استفاده از IMA DAI SDK، همانطور که در مثال پیشرفته ما نشان داده شده است، آمده است.
جلوگیری از بی توجهی یک وقفه تبلیغاتی به دنبال
بررسی کنید که آیا کاربر جستجویی را انجام داده است که از یک وقفه تبلیغاتی تماشا نشده گذشته است یا خیر، و اگر چنین است، او را به وقفه تبلیغاتی برگردانید. نمونه پیشرفته Roku به فشار دادن دکمه از راه دور برای جستجوی کاربر متکی است - هر بار که کاربر دکمه رو به جلو را فشار می دهد، در جریان با تعداد مشخصی از ثانیه به جلو می پرد. همان روشی که این پرش را مدیریت میکند، بررسی میکند که آیا پرش از آن عبور میکند یا به یک وقفه تبلیغاتی، و اگر انجام میدهد، در عوض کاربر را به شروع آن استراحت تبلیغاتی میفرستد:
Function handleFastForward(player as Object, streamManager as Object, updatedTime As Integer)
previousAd = streamManager.getPreviousCuePoint(updatedTime)
If previousAd = Invalid or previousAd.hasPlayed
player.seek(updatedTime * 1000)
Else If previousAd.start > player.currentTime
player.isSnapback = True
player.timeAfterSnapback = updatedTime
player.seek(previousAd.start * 1000 + 1000)
End If
End Function
کاربر را به جستجوی اصلی خود برگردانید
در کنترلر adBreakEnded
خود، بررسی کنید که آیا وقفه تبلیغاتی قبلی در نتیجه snapback پخش شده است یا خیر. اگر چنین است، کاربر را به مکانی که در ابتدا میخواست به دنبال آن بود برگردانید (تا زمانی که اواسط وقفه تبلیغاتی پخش نشده باشد):
player.adBreakEnded = Function(adBreakInfo as Object)
If m.isSnapback
m.seek(m.timeAfterSnapback * 1000)
m.isSnapback = False
End If
End Function
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-21 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-21 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eSnapback prevents viewers from skipping mid-roll ads by returning them to the start of the ad break if they attempt to seek past it.\u003c/p\u003e\n"],["\u003cp\u003eWhen snapback is triggered, viewers are taken back to the ad and then returned to their original seek location after the ad completes.\u003c/p\u003e\n"],["\u003cp\u003eImplementing snapback involves checking for seeks past unwatched ad breaks and redirecting the viewer, then returning them to their desired location afterwards.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code snippets demonstrate how to implement snapback using the IMA DAI SDK, handling seek events and ad break endings.\u003c/p\u003e\n"]]],[],null,["# Return to a skipped ad break\n\nAs a video publisher, you may want to prevent your viewers from\nseeking past your mid-roll ads. When a user seeks past an ad break,\nyou can take them back to the start of that ad break, and then return\nthem to their seek location after that ad break has completed. This\nfeature is called \"snapback.\"\n\nAs an example, see the diagram below. Your viewer is watching a video,\nand decides to seek from the 5-minute mark to the 15-minute mark.\nThere is, however, an ad break at the 10-minute mark that you want\nthem to watch before they can watch the content after it:\n\nIn order to show this ad break, take the following steps:\n\n1. Check if the user ran a seek that jumped past an unwatched ad break, and if so, take them back to the ad break.\n2. After the ad break completes, return them to their original seek.\n\nIn diagram form, that looks like this:\n\nHere's how to implement snapack using the IMA DAI SDK, as demonstrated in our\n[Advanced Example](//github.com/googleads/googleads-ima-roku-dai).\n\nPrevent a seek from leaving an ad break unwatched\n-------------------------------------------------\n\nCheck if the user has run a seek that went past an unwatched ad break,\nand if so, take them back to the ad break.\nThe Roku advanced sample relies on remote button presses for the\nuser to seek - each time the user presses the forward button, they\njump forward in the stream by a set number of seconds. The same\nmethod that handles this jump also checks to see if the jump\ntakes/ them past or into an ad break, and if it does, sends the user\nto the start of that ad break instead: \n\n Function handleFastForward(player as Object, streamManager as Object, updatedTime As Integer)\n previousAd = streamManager.getPreviousCuePoint(updatedTime)\n If previousAd = Invalid or previousAd.hasPlayed\n player.seek(updatedTime * 1000)\n Else If previousAd.start \u003e player.currentTime\n player.isSnapback = True\n player.timeAfterSnapback = updatedTime\n player.seek(previousAd.start * 1000 + 1000)\n End If\n End Function\n\nPut the user back to their original seek\n----------------------------------------\n\nIn your `adBreakEnded` handler, check to see if the previous ad\nbreak was played as the result of snapback. If so, return the\nuser to the place they were trying to seek to initially (as long\nas it wasn't the middle of the ad break that just played): \n\n player.adBreakEnded = Function(adBreakInfo as Object)\n If m.isSnapback\n m.seek(m.timeAfterSnapback * 1000)\n m.isSnapback = False\n End If\n End Function"]]