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 PlaybackSessionBookmarker is composed on bookmark service to manage bookmarking with Player and ComposablePlayer.
Usage
Create BookmarkService
const bookmarkService = flBookmarks.createBookmarkService(
bookmarkEndPointUrl,
platformAuthorizer,
);
Create PlaybackSessionBookmarker
const bookmarksConfiguration = {
endPointUrl: endpoint,
syncIntervalMS: 5000,
thresholdPercentage: 0.95,
};
// contentId is the unique id against which bookmarking is done
const playbackSessionBookmarker = createPlaybackSessionBookmarker(
contentId,
bookmarksConfiguration,
platformAuthorizer,
bookmarkService,
);
Bookmark Content
The PlaybackSessionBookmarker 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 addStateChangeStep(:) to bookmark content during
playback state change and playback progress respectively
// Using BookmarkManager with ComposablePlayer
composablePlayer.addStateChangeStep(
playbackSessionBookmarker.processPlayerStateChange,
);