feat(media,android): ExoPlayer DataSource for sealed files, demo player app
:shade-android-media wraps the Kotlin MediaReader as a Media3 DataSource, so ExoPlayer plays and seeks any container from a sealed file; a tampered segment fails the read instead of reaching the decoder. :shade-media-demo opens a shared watch link and plays it. Verified: Robolectric — byte-exact reads whole and in ranges, tamper refusal, ExoPlayer plays a sealed H.264/AAC clip to the end and reopens mid-file on seek. Kotlin suite 80/0. Not yet run on a device. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -116,6 +116,22 @@ On Android/JVM, `no.zyon.shade.media`: `Grants.fromCapabilityUrl(link)`,
|
||||
`inputStream()`. `LiveSubscriber(grant).open(frame)` handles live frames, and
|
||||
`MediaSealer` and `LivePublisher` write both formats byte for byte the way TS does.
|
||||
|
||||
For playback, `:shade-android-media` hands a reader to Media3/ExoPlayer, so any
|
||||
container ExoPlayer understands plays and seeks from a sealed file:
|
||||
|
||||
```kotlin
|
||||
val reader = ShadeMedia.open(link) // blocking: footer + trailer over HTTP
|
||||
player.setMediaSource(ShadeMedia.mediaSource(reader))
|
||||
player.prepare()
|
||||
```
|
||||
|
||||
`ShadeMediaDataSource` serves the plaintext ranges ExoPlayer asks for; a tampered
|
||||
segment fails the read with a `DataSourceException` instead of reaching the decoder.
|
||||
`:shade-media-demo` is a small player app for the dev phone: share a watch link to it,
|
||||
or start it with `adb shell am start -n no.zyon.shade.mediademo/.PlayerActivity --es link '<link>'`.
|
||||
Against `shade media serve` on the PC, `adb reverse tcp:3910 tcp:3910` makes a
|
||||
`http://localhost:3910/…` link work on the phone.
|
||||
|
||||
## SMF1 — the sealed file (cross-language contract)
|
||||
|
||||
All integers are big-endian.
|
||||
|
||||
Reference in New Issue
Block a user