檢查使用者是否略過未觀看的廣告插播,如果是,請將他們帶回廣告插播。
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
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-20 (世界標準時間)。"],[[["\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,[]]