Cloud Bookmarks
The bookmarks library is a personalization library that provides bookmarking service for Continue Watching feature. The library facilitates bookmarking any content at different stages of playback and also provides API to retrieve the bookmarked offset time to start playback from last watched position.
The BookmarkService
is the interface for bookmarking contract which has all the APIs to perform different bookmarking operations (Put, Delete & Get bookmark records). The BookmarksManager
is composed on bookmark service to manage bookmarking with Player
and ComposablePlayer
.
Usage
Create BookmarkService
let bookmarkService = FLBookmarksFactory.bookmarkService(endPoint: endPoint,
httpClient: httpClient,
authorizer: authorizer)
Create BookmarksManager
let config = FLBookmarksFactory.bookmarkSessionConfiguration(endPoint: endPoint,
bookmarkSyncInterval: 5000,
bookmarkThresholdPercentage: 0.95)
// contentId is the unique id against which bookmarking is done
let bmManager = FLBookmarksFactory.bookmarksManager(configuration: config,
itemId: contentId,
bookmarkService: bookmarkService,
authorizer: authorizer)
Bookmark Content
The BookmarksManager
has methods to process bookmarking at different stages of playback. One could invoke these method while playback on their own or use it along with ComposablePlayer
to automate the same. For using it with ComposablePlayer
add the functions available with bookmarks manager as inputs to addStateChangeBlock(:)
and addHeartBeatBlock(:)
to bookmark content during playback state change and playback progress respectively
// Using BookmarkManager with ComposablePlayer
composablePlayer.addStateChangeBlock(bookmarksManager.processPlaybackStateChange)
composablePlayer.addHeartBeatBlock(bookmarksManager.processPlaybackProgress)