บันทึกและโหลดบุ๊กมาร์กสตรีมโฆษณา
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
คู่มือนี้จะแสดงวิธีใช้การบุ๊กมาร์กโดยใช้ IMA DAI SDK
เมื่อใช้การแทรกโฆษณาแบบไดนามิก (DAI) สำหรับสตรีมวิดีโอออนดีมานด์ (VOD)
ซึ่งจะถือว่ามีการติดตั้งใช้งาน IMA DAI ที่ทำงานอยู่ เช่น การติดตั้งใช้งานที่แสดงใน
เริ่มต้นใช้งาน
การบุ๊กมาร์กคืออะไร
การสร้างบุ๊กมาร์กคือความสามารถในการบันทึกแล้วกลับไปยังจุดที่ต้องการ
ในสตรีมเนื้อหา สมมติว่าผู้ใช้ดูเนื้อหา 5 นาที
ออกจากสตรีมวิดีโอ แล้วกลับมาที่วิดีโอนี้ การสร้างบุ๊กมาร์กจะบันทึก
ตำแหน่งของผู้ใช้ในสตรีม ทำให้สตรีมสามารถเล่นต่อได้
ที่หยุดไว้และมอบประสบการณ์ที่ราบรื่นให้แก่ผู้ชม
บุ๊กมาร์ก DAI ขั้นสูง
เมื่อบุ๊กมาร์กสตรีม DAI คุณต้องบันทึกรหัสและเวลาของสตรีม
เมื่อผู้ใช้ออกจากวิดีโอ เมื่อผู้ใช้กลับมา ให้ส่งคำขอ
สตรีมและกรอไปยังเวลาที่บันทึก เนื่องจากแต่ละอินสแตนซ์ของ
สตรีมสามารถมีช่วงพักโฆษณาในระยะเวลาที่แตกต่างกันได้เพียงแค่บันทึกสตรีมเท่านั้น
เวลาไม่ได้ผล สิ่งที่คุณต้องการทำจริงๆ ก็คือ
ดำเนินการต่อจากเดิม
Content time
วิธีการ Conversion ที่จะช่วยคุณได้
IMA DAI SDK มีวิธีขอเวลาของเนื้อหา 2 วิธี
สำหรับเวลาสตรีมและเวลาสตรีมสำหรับเนื้อหาที่กำหนด
เวลา เมื่อใช้วิธี Conversion เหล่านี้ คุณจะสามารถจัดเก็บบุ๊กมาร์ก
เวลาเนื้อหา แล้วหาเวลาสตรีมที่เกี่ยวข้องใน
อินสแตนซ์ใหม่ของสตรีม ต่อไปนี้คือวิธีการ รวมถึงลิงก์
ไปยังแอปตัวอย่างที่แสดงการใช้งานการบุ๊กมาร์กที่ใช้งานได้
กำลังบันทึกบุ๊กมาร์ก
บันทึกบุ๊กมาร์กเมื่อกิจกรรมหยุดชั่วคราว
Saves the current time as a bookmark in the current video.
Function saveBookmarkTime(player as Object, streamManager as Object) as Void
m.videos[player.video.index].bookmarkTime =
streamManager.getContentTime(player.currentTime * 1000)
End Function
กำลังโหลดบุ๊กมาร์ก
โหลดบุ๊กมาร์กเมื่อขอสตรีมอีกครั้ง เป็นส่วนหนึ่งของการติดตั้งใช้งาน
อินเทอร์เฟซของ VideoStreamPlayer
player.loadUrl = Function(streamInfo as Object)
...
If m.video.bookmarkTime > 0
streamTime = m.streamManager.getStreamTime(m.video.bookmarkTime)
m.videoPlayer.seek(streamTime)
End If
End Function
แอปตัวอย่าง
แอปตัวอย่าง
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-21 UTC
[null,null,["อัปเดตล่าสุด 2025-08-21 UTC"],[[["\u003cp\u003eThis guide explains how to implement bookmarking in video-on-demand (VOD) streams using the IMA DAI SDK for Roku, allowing users to resume playback from where they left off.\u003c/p\u003e\n"],["\u003cp\u003eBookmarking with DAI involves saving the content time, not just the stream time, to ensure accurate resumption due to potential ad break variations.\u003c/p\u003e\n"],["\u003cp\u003eThe IMA DAI SDK provides methods to convert between stream time and content time, enabling the storage and retrieval of bookmarks based on content progress.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can implement bookmarking by saving the content time when the video is paused and retrieving it to seek to the corresponding stream time when the stream is reloaded.\u003c/p\u003e\n"],["\u003cp\u003eA sample app demonstrating a working bookmarking implementation is available on GitHub for reference and further exploration.\u003c/p\u003e\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/roku/dai).\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 Saves the current time as a bookmark in the current video.\n Function saveBookmarkTime(player as Object, streamManager as Object) as Void\n m.videos[player.video.index].bookmarkTime =\n streamManager.getContentTime(player.currentTime * 1000)\n End Function\n\nLoading bookmarks\n-----------------\n\nLoad the bookmark when re-requesting a stream. It's part of implementing\nthe `VideoStreamPlayer` interface. \n\n player.loadUrl = Function(streamInfo as Object)\n ...\n If m.video.bookmarkTime \u003e 0\n streamTime = m.streamManager.getStreamTime(m.video.bookmarkTime)\n m.videoPlayer.seek(streamTime)\n End If\n End Function\n\nSample app\n----------\n\n[Sample app](//github.com/googleads/googleads-ima-roku-dai)"]]