beautified some ui
This commit is contained in:
@@ -24,6 +24,22 @@ the course service or extracted from subtitle/speech analysis data.
|
||||
These defaults match the desktop player's arrow-key workflow while fitting a
|
||||
tablet touch screen.
|
||||
|
||||
## Sentence Playback Modes
|
||||
|
||||
`PlayerConfig.continuousPlayback` controls how playback crosses sentence
|
||||
boundaries:
|
||||
|
||||
- `true` (default): the video plays continuously through all sentences.
|
||||
- `false`: playback stays on the current sentence; when its boundary is
|
||||
reached, playback loops back to the start of the same sentence until the
|
||||
student swipes to the previous/next sentence.
|
||||
|
||||
Toggle it at runtime with `controller.setContinuousPlayback(enabled)`.
|
||||
|
||||
`controller.playCurrentSentenceAndStop()` plays only the current sentence and
|
||||
automatically pauses once it finishes — useful for a "play the reference
|
||||
sentence" button in a recording test flow.
|
||||
|
||||
## Basic Integration
|
||||
|
||||
```kotlin
|
||||
@@ -123,6 +139,63 @@ sdk.videoCatalogApi.fetch(object : VideoCatalogCallback {
|
||||
})
|
||||
```
|
||||
|
||||
## Sample App Configuration
|
||||
|
||||
The sample app points at the cloud service through the `SERVER_BASE_URL`
|
||||
constant at the top of `MainActivity.kt`:
|
||||
|
||||
```kotlin
|
||||
const val SERVER_BASE_URL = "https://videoservice.d1kt.cn"
|
||||
```
|
||||
|
||||
Change it to your real deployment address before building the APK. For a LAN
|
||||
or development server, an `http://<server-ip>:<port>` address works because the
|
||||
sample app permits cleartext HTTP (see
|
||||
`res/xml/network_security_config.xml`); production should keep HTTPS.
|
||||
|
||||
The sample app also enables `allowHttpFallback`: if an `https://` request fails
|
||||
with a TLS error (for example a misconfigured or unstable gateway/certificate),
|
||||
the SDK automatically retries the same request over plain HTTP. This is a
|
||||
convenience for private deployments only — fix the TLS edge in production.
|
||||
|
||||
The app has two modules, switched by the `训练` / `测试` tabs at the top:
|
||||
|
||||
- `训练`: browse the cloud course list and do sentence-by-sentence playback
|
||||
practice. The old built-in "示例课程" card was removed; only courses served
|
||||
by `GET /api/v1/videos` appear here.
|
||||
- `测试`: record your reading of the current sentence and submit it to the
|
||||
server's assessment endpoint for AI scoring. Only cloud courses are
|
||||
supported (the server must know the video hash and reference sentences).
|
||||
|
||||
The video's bottom-right corner has a small rotation icon that forces landscape
|
||||
or portrait orientation, so rotation works even when the device's auto-rotate
|
||||
switch is turned off. The progress bar below the sentence panel is draggable,
|
||||
so the student can seek to any position by dragging it.
|
||||
|
||||
For the test module, fill in the client key that the server expects in the
|
||||
`X-Client-Key` header (the `CLIENT_API_KEY` value from the server's
|
||||
`sentence_api/.env`):
|
||||
|
||||
```kotlin
|
||||
const val ASSESSMENT_API_KEY = "replace-with-your-client-api-key"
|
||||
```
|
||||
|
||||
The app requests microphone permission at runtime on first use.
|
||||
|
||||
### Troubleshooting "云端暂不可用"
|
||||
|
||||
That label means `GET /api/v1/videos` failed. Since the fix, the sample app
|
||||
shows the underlying error next to the label (for example DNS resolution,
|
||||
timeout, TLS, or an unexpected HTTP status). Common causes:
|
||||
|
||||
- The APK was built with the wrong `SERVER_BASE_URL` for your deployment.
|
||||
- The phone cannot reach the domain/IP (check with a browser on the phone, and
|
||||
verify the server with `curl https://<server>/api/v1/videos`).
|
||||
- The gateway only exposes plain HTTP, so the app must use `http://...` instead
|
||||
of `https://...`.
|
||||
- The server certificate is invalid/self-signed on the phone; use HTTP for
|
||||
internal testing or install a valid certificate at the gateway.
|
||||
|
||||
## Local Video Testing
|
||||
|
||||
The computer path `/Users/...` is not visible to an Android device. For a
|
||||
|
||||
Reference in New Issue
Block a user