Files
ReadViewSDK/Sources/RDSpeechReaderView/README.md
T
2026-07-27 21:43:13 +08:00

1.3 KiB

RDSpeechReaderView

RDSpeechReaderView provides bounded, on-device text-to-speech playback for ReadViewSDK readers. It uses AVSpeechSynthesizer and does not upload book content or create exportable audio files.

Install

pod 'RDSpeechReaderView'
pod 'RDPDFReaderView/Speech'
pod 'RDEpubReaderView/Speech'

The host app must enable the Audio, AirPlay, and Picture in Picture background mode to continue reading after it enters the background.

Use with PDF

let provider = reader.makeSpeechContentProvider()
let speech = RDSpeechReaderController(contentProvider: provider)
try await speech.start()

The PDF adapter reads RDPDFReaderTextRun values supplied by the host or by PDFKit. Image-only PDFs require an OCR-backed provider before they can speak.

For automatic page navigation and temporary read-aloud highlighting, create a PDF session instead:

let session = reader.makeSpeechSession()
try await session.start(from: 0)

Use with EPUB

let provider = reader.makeSpeechContentProvider()
let speech = RDSpeechReaderController(contentProvider: provider)
try await speech.start(from: nil)

Speech locations use EPUB href plus a UTF-16 text offset. They remain stable when the user changes fonts or page size, unlike screen page numbers.