Để thảo luận và đưa ra ý kiến phản hồi về các sản phẩm của chúng tôi, hãy tham gia kênh Discord chính thức của Ad Manager trong máy chủ Cộng đồng quảng cáo và đo lường của Google.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Là nhà xuất bản video, bạn nên ngăn người xem
tìm kiếm qua quảng cáo trong video. Khi người dùng tìm kiếm một điểm chèn quảng cáo,
bạn có thể đưa họ trở lại điểm bắt đầu của điểm chèn quảng cáo, sau đó quay lại
họ đến vị trí tìm kiếm của mình sau khi điểm chèn quảng cáo đó hoàn tất. Chiến dịch này
được gọi là "quay lại".
Để biết ví dụ, hãy xem sơ đồ dưới đây. Khán giả đang xem video,
và quyết định tìm từ mốc 5 phút đến mốc 15 phút.
Tuy nhiên, có một điểm chèn quảng cáo ở mốc 10 phút mà bạn muốn
để trẻ xem trước khi xem nội dung sau khi video đó kết thúc:
Để hiển thị điểm chèn quảng cáo này, hãy làm theo các bước sau:
Kiểm tra xem người dùng có chạy một lượt tìm kiếm nhảy qua điểm chèn quảng cáo mà bạn chưa xem hay không,
và nếu có, hãy đưa họ trở lại điểm chèn quảng cáo.
Sau khi điểm chèn quảng cáo kết thúc, hãy đưa các quảng cáo trở về lượt tìm kiếm ban đầu.
Ở dạng biểu đồ, mã sẽ có dạng như sau:
Dưới đây là cách triển khai quy trình làm việc này trong SDK IMA DAI, như được thực hiện trong
AdvancedExample.
Ngăn lượt tìm kiếm để lại một điểm chèn quảng cáo chưa được xem
Kiểm tra xem người dùng có chạy một lượt tìm kiếm mà đã vượt qua điểm chèn quảng cáo mà bạn chưa xem hay không,
và nếu có, hãy đưa họ trở lại điểm chèn quảng cáo.
Trong SDK Android, hãy sử dụng đối tượng PlayerControl để phát hiện tua.
Khi người dùng tìm kiếm, hãy kích hoạt phương thức onSeek() của
SampleHlsVideoPlayerCallback do SampleAdsWrapper triển khai.
Phương thức này (được trình bày bên dưới) kiểm tra điểm dừng trước khi người dùng
thời gian tua. Nếu video chưa được phát, hãy tìm đến đầu điểm chèn quảng cáo đó
thay vì điểm tua mong muốn ban đầu và lưu lượt tua mong muốn đó
điểm ở snapBackTime.
Bây giờ, khi bạn nhận được một sự kiện trên onAdBreakEnded, hãy kiểm tra xem snapBackTime có phải là
đã được đặt. Nếu có, hãy đưa người dùng đến điểm đó trong luồng vì quảng cáo
điểm chèn quảng cáo mà họ vừa xem là kết quả của việc quay lại quảng cáo:
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-08-21 UTC."],[[["\u003cp\u003eSnapback prevents viewers from skipping mid-roll ads by redirecting them to the ad and then returning them to their intended location.\u003c/p\u003e\n"],["\u003cp\u003eThis feature ensures ad completion before viewers proceed to the content they seek.\u003c/p\u003e\n"],["\u003cp\u003eSnapback functionality is implemented through the IMA DAI SDK, as demonstrated in the AdvancedExample.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves identifying unwatched ad breaks and redirecting the viewer and then resuming playback at the target point after the ad.\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\n[AdvancedExample](//github.com/googleads/googleads-ima-android-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.\nIn the Android SDK, use the `PlayerControl` object to detect seeking.\nWhen the user seeks, trigger the `onSeek()` method of the\n`SampleHlsVideoPlayerCallback` implemented by `SampleAdsWrapper`.\nThat method (presented below) checks the cue point prior to the user's\nseek time. If it is unplayed, seek to the beginning of that ad break\ninstead of their initial desired seek point, and save that desired seek\npoint in `snapBackTime`. \n\n @Override\n public void onSeek(int timeMillis) {\n double timeToSeek = timeMillis;\n if (streamManager != null) {\n CuePoint cuePoint =\n streamManager.getPreviousCuePointForStreamTime(timeMillis / 1000);\n if (cuePoint != null && !cuePoint.isPlayed()) {\n snapBackTime = timeToSeek / 1000.0; // Update snapback time.\n // Missed cue point, so snap back to the beginning of cue point.\n timeToSeek = cuePoint.getStartTime() * 1000;\n videoPlayer.seek(Math.round(timeToSeek));\n videoPlayer.setCanSeek(false);\n return;\n }\n }\n videoPlayer.seek(Math.round(timeToSeek));\n }\n\nPut the user back to their original seek\n----------------------------------------\n\nNow when you get an `onAdBreakEnded` event, check to see if `snapBackTime`\nis set. If so, take the user to that point in the stream, because the ad\nbreak they just watched was the result of snapback: \n\n @Override\n public void onAdBreakEnded() {\n // Re-enable player controls.\n videoPlayer.setCanSeek(true);\n videoPlayer.enableControls(true);\n if (snapBackTime \u003e 0) {\n videoPlayer.seek(Math.round(snapBackTime * 1000));\n }\n snapBackTime = 0;\n }"]]