Reader Control
See what the user is reading, and move, play or pause it.
See the reader
GET /api/v1/reader needs reader:read.
source | What you get |
|---|---|
live | A reader view is open and sharing: the document, the sentence's segmentKey and text, the PDF page, selected text, and playback (playing, paused or preparing) |
saved | The last document opened and its saved position |
open is reader when a reader view is sharing, library when OpenReader is open on another page, and null otherwise. webUrl opens the reader there. With no document ever opened, the answer is 404 READER_EMPTY.
Move, play or pause
POST /api/v1/reader/commands needs reader:control.
{ "type": "goto", "documentId": "…", "at": "<segmentKey>" }Opens a document at a sentence from search, chapters or the reader. page picks a PDF page instead, or when the sentence is gone. Playback the user started carries on from there; goto never starts it. From the library it opens the document in that page.
Outcomes
The response is { outcome, webUrl }. For goto, webUrl opens the reader at the target.
outcome | Meaning |
|---|---|
done | The reader did it |
sent | It reached the reader, which did not report back within five seconds |
not_found | The sentence or page is not in the document |
needs_user_gesture | The browser will not start audio until the user clicks the page |
failed | The reader could not do it |
not_open | No reader view is sharing |
Sharing
Approving an app shares nothing yet. The first call to either endpoint asks the user, in each open OpenReader page, whether to share their reader. The call waits up to 60 seconds. Their answer becomes the default for every app, and they can change it in Connected apps.
| Answer | Meaning |
|---|---|
409 READER_NEEDS_APPROVAL | Not answered yet. Ask the user to open OpenReader and answer, then call again. |
403 READER_NOT_SHARED | The default is Keep private and no document is shared |
403 DOCUMENT_NOT_SHARED | goto to a document the user keeps private |
A reader view shares only while an app holding a reader scope is connected. A document the user keeps private never appears here, live or saved, and play or pause while it is open answers not_open.
Live reader state is never stored. OpenReader asks the open tabs when an app asks.