更新阅读器功能与示例
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# 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
|
||||
|
||||
```ruby
|
||||
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
|
||||
|
||||
```swift
|
||||
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:
|
||||
|
||||
```swift
|
||||
let session = reader.makeSpeechSession()
|
||||
try await session.start(from: 0)
|
||||
```
|
||||
|
||||
## Use with EPUB
|
||||
|
||||
```swift
|
||||
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.
|
||||
Reference in New Issue
Block a user