Để 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.
Hướng dẫn này trình bày cách triển khai dấu trang bằng cách sử dụng SDK IMA DAI
khi sử dụng tính năng Chèn quảng cáo động (DAI) cho luồng video theo yêu cầu (VOD).
Điều này giả định một phương thức triển khai IMA DAI đang hoạt động, chẳng hạn như quy trình được trình bày trong
Bắt đầu.
Đánh dấu trang là gì?
Đánh dấu trang là khả năng lưu rồi quay lại một điểm cụ thể
trong luồng nội dung. Giả sử một người dùng xem 5 phút nội dung,
rời khỏi luồng video rồi quay lại luồng đó. Đánh dấu trang sẽ lưu
vị trí của người dùng trong luồng để luồng có thể tiếp tục từ vị trí
còn lại, mang lại trải nghiệm liền mạch cho người xem.
Tìm hiểu sâu về tính năng đánh dấu trang của DAI
Khi đánh dấu trang một luồng DAI, bạn phải ghi lại thời gian và id luồng
khi người dùng rời khỏi video. Khi người dùng quay lại, hãy yêu cầu lại
phát trực tuyến và tua đến thời gian đã tiết kiệm được. Vì mỗi lần xuất hiện của yêu cầu
luồng có thể có các điểm chèn quảng cáo với thời lượng khác nhau chỉ đơn giản là lưu luồng
thời gian sẽ không hoạt động. Những gì bạn thực sự muốn làm là tiếp tục từ
nội dung.
Phương thức chuyển đổi để khôi phục
SDK IMA DAI cung cấp một cặp phương thức để yêu cầu thời gian nội dung
cho thời gian truyền trực tuyến và thời gian truyền trực tuyến nhất định cho một nội dung cụ thể
. Khi sử dụng các phương pháp chuyển đổi này, bạn có thể lưu trữ
thời gian phát nội dung rồi tìm thời gian phát trực tiếp tương ứng ở
thực thể mới của luồng. Sau đây là cách tiếp cận, bao gồm cả một đường liên kết
đến một ứng dụng mẫu cho thấy cách triển khai đánh dấu trang đang hoạt động.
Tải dấu trang khi yêu cầu lại luồng. Đó là một phần của quá trình triển khai
giao diện VideoStreamPlayer.
publicvoidloadUrl(Stringurl,List<HashMap<String,String>>subtitles){//Setvideoplayer's stream URL and subtitles, and play the stream....//Bookmarking.if(bookmarkTime > 0){doublestreamTime=streamManager.getStreamTimeForContentTime(bookmarkTime);videoPlayer.seek((long)(streamTime*1000.0));//stoms.}}
[[["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\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 stream time, to ensure accurate playback resumption.\u003c/p\u003e\n"],["\u003cp\u003eThe IMA DAI SDK provides methods to convert between stream time and content time for bookmarking purposes.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can save bookmarks when the activity is paused and load them when the stream is re-requested.\u003c/p\u003e\n"],["\u003cp\u003eA sample app demonstrating bookmarking implementation is available on GitHub.\u003c/p\u003e\n"]]],["Bookmarking in IMA DAI involves saving the user's position in a video stream for later continuation. Instead of recording the stream time, the key is to save the content time. When a user leaves, record the stream ID and convert the current stream time to content time using `getContentTimeForStreamTime()`. Upon return, re-request the stream and use `getStreamTimeForContentTime()` to find the corresponding stream time to seek to. Bookmarks are saved when the `Activity` pauses and loaded when re-requesting a stream.\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/android/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 private double bookmarkTime;\n @Override\n public void onPause() {\n super.onPause();\n double streamTime = videoPlayer.getCurrentPosition() / 1000.0; // ms to s.\n bookmarkTime = streamManager.getContentTimeForStreamTime(streamTime);\n }\n\nLoading bookmarks\n-----------------\n\nLoad the bookmark when re-requesting a stream. It's part of implementing\nthe `VideoStreamPlayer` interface. \n\n public void loadUrl(String url, List\u003cHashMap\u003cString, String\u003e\u003e subtitles) {\n // Set video player's stream URL and subtitles, and play the stream.\n ...\n\n // Bookmarking.\n if (bookmarkTime \u003e 0) {\n double streamTime =\n streamManager.getStreamTimeForContentTime(bookmarkTime);\n videoPlayer.seek((long) (streamTime * 1000.0)); // s to ms.\n }\n }\n\nSample app\n----------\n\n[Download the Sample app](//github.com/googleads/googleads-ima-android-dai)\nto see a bookmarking implementation."]]