건너뛴 광고 시점으로 돌아가기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
동영상 게시자는
미드롤 광고를 지나칠 수 있습니다 사용자가 광고 시점 지나를 검색하면
광고 시간의 시작 부분으로 되돌린 다음
탐색 위치로 이동할 수 있습니다. 이
'스냅백'이라고 부릅니다.
예를 들어 아래 다이어그램을 참조하세요. 시청자가 동영상을 시청하고 있을 때
5분 표시에서 15분 표시까지 탐색하기로 결정합니다.
그러나 원하는 10분 표시 시점에 광고 시점이
다음 콘텐츠를 시청하기 전에 미리 볼 수 있습니다.

이 광고 시점을 표시하려면 다음 단계를 따르세요.
- 사용자가 시청하지 않은 광고 시점을 넘어서 탐색했는지 확인합니다.
그렇다면 광고 시점으로 돌아가세요.
- 광고 시점이 완료되면 원래 탐색으로 되돌립니다.
이를 다이어그램 형식으로 표현하면 다음과 같습니다.

이 워크플로를 IMA DAI SDK에서 구현하는 방법은
AdvancedExample.
탐색이 광고 시점을 시청하지 않은 상태로 남겨두지 않도록 방지
사용자가 시청하지 않은 광고 시점을 지나 탐색을 실행했는지 확인합니다.
그렇다면 광고 시점으로 돌아가세요.
iOS 고급 예에서는 사용자와 UI의 상호작용을 사용합니다.
탐색을 실행한 시점을 감지합니다. 확인할 탐색 시작 시간 보존
탐색 중에 재생되지 않은 광고 시간을 통과한 경우입니다. 사용자가
를 누르면 현재 시간과 시작 시간을 비교합니다.
가장 최근의 광고 시점입니다. 탐색 시작 이후에 광고 시간이 속하는 경우
아직 재생되지 않은 경우
광고 시점의 시작으로 돌아가도록 탐색하세요. 또한 스냅백 플래그를
나중에 광고 시간 완료 핸들러에서 확인할 수 있습니다.
- (IBAction)videoControlsTouchStarted:(id)sender {
self.seekStartTime = self.contentPlayer.currentTime;
}
- (IBAction)videoControlsTouchEnded:(id)sender {
self.seekEndTime = CMTimeMake(self.progressBar.value, 1);
IMACuepoint *lastCuepoint =
[self.streamManager previousCuepointForStreamTime:CMTimeGetSeconds(self.seekEndTime)];
if (!lastCuepoint.played && (lastCuepoint.startTime > CMTimeGetSeconds(self.seekStartTime))) {
self.snapbackMode = YES
// Add 1 to the seek time to get the keyframe at the start of the ad to be your landing place.
[self.contentPlayer seekToTime:CMTimeMakeWithSeconds(lastCuepoint.startTime + 1, NSEC_PER_SEC)];
}
}
사용자를 원래 탐색으로 되돌리기
광고 시간 종료 핸들러에서 이전
스냅백의 결과로 재생되었습니다. 이 경우 사용자를 반환합니다.
그들이 처음에 찾고자 했던 장소에 가서
는 방금 재생된 광고 시점의 중간이 아닙니다).
- (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdEvent:(IMAAdEvent *)event {
switch (event.type) {
case kIMAAdEvent_AD_BREAK_ENDED: {
if (self.snapbackMode) {
self.snapbackMode = NO;
if (CMTimeCompare(self.seekEndTime, self.contentPlayer.currentTime)) {
[self.contentPlayer seekToTime:self.seekEndTime];
}
}
break;
}
}
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-21(UTC)
[null,null,["최종 업데이트: 2025-08-21(UTC)"],[[["\u003cp\u003eSnapback prevents viewers from skipping mid-roll ads by returning them to the start of the ad break if they seek past it.\u003c/p\u003e\n"],["\u003cp\u003eWhen a viewer seeks past an unwatched ad, the feature takes them back to the ad and then returns them to their intended location after the ad completes.\u003c/p\u003e\n"],["\u003cp\u003eImplementing snapback involves checking for seeks that bypass unwatched ads and using ad break event handlers to redirect the viewer accordingly.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code snippets demonstrate how to detect ad-skipping seeks and trigger the snapback functionality within the IMA DAI SDK.\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 this workflow in the IMA DAI SDK, as done in the\n[AdvancedExample](//github.com/googleads/googleads-ima-ios-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.\nFor the iOS Advanced example, use the user's interaction with your UI\nto detect when they have run a seek. Preserve the seek start time to check\nif they've passed an unplayed ad break in their seek. When the user\nreleases the video controls, compare their current time to the time of\nthe most recent ad break. If the ad break falls after the seek start\ntime (meaning the user has jumped past it) and it hasn't yet been played,\nseek them back to the start of the ad break. Also, set a snapback flag\nto check later in your ad break complete handler: \n\n - (IBAction)videoControlsTouchStarted:(id)sender {\n self.seekStartTime = self.contentPlayer.currentTime;\n }\n\n - (IBAction)videoControlsTouchEnded:(id)sender {\n self.seekEndTime = CMTimeMake(self.progressBar.value, 1);\n IMACuepoint *lastCuepoint =\n [self.streamManager previousCuepointForStreamTime:CMTimeGetSeconds(self.seekEndTime)];\n if (!lastCuepoint.played && (lastCuepoint.startTime \u003e CMTimeGetSeconds(self.seekStartTime))) {\n self.snapbackMode = YES\n // Add 1 to the seek time to get the keyframe at the start of the ad to be your landing place.\n [self.contentPlayer seekToTime:CMTimeMakeWithSeconds(lastCuepoint.startTime + 1, NSEC_PER_SEC)];\n }\n }\n\nPut the user back to their original seek\n----------------------------------------\n\nIn your ad-break-ended handler, check to see if the previous\nbreak was played as the result of snapback. If so, return the user\nto the place they were trying to seek to initially (as long as it\nwasn't the middle of the ad break that just played): \n\n - (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdEvent:(IMAAdEvent *)event {\n switch (event.type) {\n case kIMAAdEvent_AD_BREAK_ENDED: {\n if (self.snapbackMode) {\n self.snapbackMode = NO;\n if (CMTimeCompare(self.seekEndTime, self.contentPlayer.currentTime)) {\n [self.contentPlayer seekToTime:self.seekEndTime];\n }\n }\n break;\n }\n }\n }"]]