2026-10-18 21:33:32 +02:00
|
|
|
plugins {
|
|
|
|
|
id("com.android.library")
|
|
|
|
|
kotlin("android")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Sealed Shade media (SMF1) in Media3/ExoPlayer.
|
|
|
|
|
//
|
|
|
|
|
// `:shade-android` reads and verifies sealed files on the JVM; this module
|
|
|
|
|
// hands that reader to ExoPlayer as a DataSource, so any container the
|
|
|
|
|
// player understands (MP4, WebM, MKV, MP3, …) plays and seeks from a sealed
|
|
|
|
|
// file without the plaintext ever touching disk or the network.
|
|
|
|
|
|
|
|
|
|
android {
|
|
|
|
|
namespace = "no.zyon.shade.media.android"
|
|
|
|
|
compileSdk = 35
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
minSdk = 24
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kotlinOptions {
|
|
|
|
|
jvmTarget = "17"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testOptions {
|
|
|
|
|
unitTests.isIncludeAndroidResources = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val media3 = "1.5.1"
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
api(project(":shade-android"))
|
|
|
|
|
api("androidx.media3:media3-exoplayer:$media3")
|
|
|
|
|
api("androidx.media3:media3-datasource:$media3")
|
feat(media,android): live channels in ExoPlayer — LiveWatcher, ShadeLiveDataSource
LiveWatcher is the Android LiveWatchClient (OkHttp WebSocket, subscribe
with the read token, reconnect with backoff, backlog deduplicated by the
subscriber). ShadeLiveDataSource turns frames into one endless WebM/fMP4
stream for ExoPlayer's extractors: init, then media from the first
keyframe, and after a gap nothing until the next keyframe. Late joiners
start at 0:00 (fMP4: per-join TimestampAdjuster; WebM: cluster Timecode
rewritten in place). A changed init fails with a ParserException (not
retried). The demo app plays live video and follows log channels.
LiveSubscriber.close() wipes keys, as in TS.
Verified (Robolectric): late join on H.264/AAC fMP4 and VP8/Opus WebM cut
by the TS splitter (fixtures from scripts/make-live-fixtures.ts) plays
from the keyframe, rebased (mutation check: without the rebase the WebM
test fails, 5020 vs 4250 ms); gap recovery; format change; LiveWatcher
against MockWebServer with a dropped connection and backlog replay.
Kotlin 81/0. Not yet run on a device.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-18 21:53:17 +02:00
|
|
|
// Live channels: the relay speaks WebSocket. `api`: LiveWatcher takes an OkHttpClient.
|
|
|
|
|
api("com.squareup.okhttp3:okhttp:4.12.0")
|
2026-10-18 21:33:32 +02:00
|
|
|
|
|
|
|
|
testImplementation("junit:junit:4.13.2")
|
|
|
|
|
testImplementation("org.robolectric:robolectric:4.14.1")
|
|
|
|
|
testImplementation("androidx.test:core:1.6.1")
|
|
|
|
|
testImplementation("androidx.media3:media3-test-utils:$media3")
|
|
|
|
|
testImplementation("androidx.media3:media3-test-utils-robolectric:$media3")
|
feat(media,android): live channels in ExoPlayer — LiveWatcher, ShadeLiveDataSource
LiveWatcher is the Android LiveWatchClient (OkHttp WebSocket, subscribe
with the read token, reconnect with backoff, backlog deduplicated by the
subscriber). ShadeLiveDataSource turns frames into one endless WebM/fMP4
stream for ExoPlayer's extractors: init, then media from the first
keyframe, and after a gap nothing until the next keyframe. Late joiners
start at 0:00 (fMP4: per-join TimestampAdjuster; WebM: cluster Timecode
rewritten in place). A changed init fails with a ParserException (not
retried). The demo app plays live video and follows log channels.
LiveSubscriber.close() wipes keys, as in TS.
Verified (Robolectric): late join on H.264/AAC fMP4 and VP8/Opus WebM cut
by the TS splitter (fixtures from scripts/make-live-fixtures.ts) plays
from the keyframe, rebased (mutation check: without the rebase the WebM
test fails, 5020 vs 4250 ms); gap recovery; format change; LiveWatcher
against MockWebServer with a dropped connection and backlog replay.
Kotlin 81/0. Not yet run on a device.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-18 21:53:17 +02:00
|
|
|
testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
|
2026-10-18 21:33:32 +02:00
|
|
|
}
|