GN, MH and I spent some time yesterday developing a model for the bookmarking system that will be in the new, eXist version of the FrancoToile site. After throwing around a few ideas, we've settled on this:
A "bookmark" is a reference to a single timestamp in a video. In addition to containing the video ID and the timestamp, a bookmark can also contain an optional comment. Each bookmark is stored in a separate XML document in the eXist database. A proposed sample looks like this:
<bookmark id="b3" videoId="fraq1" timestamp="00:05:35.55">
<comment>Note the usage of 'dans' in this context.</comment>
</bookmark>
Notes on the bookmark attributes:
- @id is a unique, sequential ID, prefixed by "b", generated upon bookmark creation.
- @videoId is the ID of the video file.
- @timestamp is used rather than an utterance ID, so that a user can bookmark an exact moment in the video rather than a general utterance.
A bookmark can never be edited or deleted via the public website, only by someone with access to the database.
When a user adds a bookmark to a video, an AJAX call is made that stores the new document and, upon success, returns the new unique ID of that bookmark. The unique ID is then appended to the query string in the user's URL. This query string method is how bookmark "collections" are created: they're simply a series of bookmark IDs in the URL.
When a user "deletes" a bookmark, they are not, in fact, deleting it, just removing the ID from their collection URL. Similarly, when a user changes the order of the bookmarks, this simply changes the order of the IDs in the URL.
Since bookmarks can't be edited, if a user wants to edit a bookmark - for example, adding or changing a comment - a new bookmark is created to reflect these changes and added to the user's URL. The original bookmark is then removed from the URL.
So, every action related to manipulating bookmarks results in a change to the URL the user used to access the video. When a user clicks on the "save my bookmarks" link, they are simply given the URL, which they can then share with others.