# Continue Watching Feed

## Introduction

Customers that want to implement the remote "continue watching" [feature](https://docs.applicaster.com/using-zapp/player/resume-playing),  should implement 3 API gateways:

1. A POST URL to [video.stopped Cloud Event](./cloud-events.md) that will be sent anytime the user stopped the video player.
2. A Synced feed that the app will query periodically to get information about the remote list of unfinished videos (See bellow)
3. Optional - [A full JSON feed with a list of all of unfinished videos to show inside a component](https://docs.applicaster.com/using-zapp/player/resume-playing#promote-unfinished-items-on-a-screen)

## Synced feed

The plugin will request on app launch + every hour the feed to retrieve the list of server stored resume watching list. 

The structure of the feed should be written in the following format:

```json

{
  "entry": [
    {
      "id": "296bed86-11dc-43c3-9aaf-bfb25600ad2a", // the unique id of the video
      "extensions": {
          "resumeLastUpdate": <TIMESTAMP>
          "resumeTime": "<Number of seconds from the beginning of the video from which playback should start when playing this item>",
          "progress": 0.43 // number between 0 - 1 indecating the progress of the fed
          "resumeCompleted": true // When set to true, the app will use this info to remove the video from the list
        }
      }
    }, {...}, {...}
  ]
}
```

- The app will call the feed at app launch + every hour to sync and retrieve the most up to date  list of videos.
- The feed should follow the Pipes2 endpoints spec. Probably it will need to use the user’s id as a context key to be able to return a personalized list.

- The response of the feed will be merged with the local resume watching list as follows:

  - Local list and remote feed items will be ordered by timestamp.

  - If local and remote feeds share the same id they will be merged to a single item - (the latest timestamp remote / local will “win” in case of conflicts”.

- The list will be filtered to store the max list size determined by the plugin config settings.
