Release 0.1.6 with one quality setting and silent skips
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m19s

Playback mode and transcode quality become one quality list: Original
quality (direct stream of the source video, the default), then 4K,
1080p, 720p and 480p conversions, with earlier preferences migrated.
Left/Right taps during playback skip 10 seconds without showing the
controls; holding still opens the timeline, which now keeps focus
instead of losing it to Play. Player checks wait for playback to be
ready and inspect the screen while paused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-10-24 14:48:55 -07:00
parent 6a53196748
commit 74afc7f3d4
16 changed files with 113 additions and 43 deletions

View file

@ -72,7 +72,7 @@ These require the private test session. Playback test intents (`testTitleId`, `t
- Preserve explicit D-pad row/column targets and fixed card geometry. Avoid expensive beyond-bounds focus searches, per-focus catalog recomposition and full-screen gradient overdraw. Contrast is baked into cached backdrop bitmaps off the main thread.
- Give every Media3 session a unique ID: next-episode creation can overlap the old controller's disposal. Plex HLS position is absolute; **do not add the requested resume offset again**.
- Handle remote Back explicitly before default focus handling. Wait for menu focus restoration in tests instead of sending blind rapid button sequences.
- Direct stream is the default preference, with original-file and conversion options available in-player. Augment Plex's existing HEVC target; competing transcode targets previously forced unnecessary H.264 conversion. A server decision to copy video does not itself prove successful rendering.
- Playback has one quality preference (`StreamQuality`): **Original quality** (the default) direct-streams the source video, falling back to a 1080p conversion if the TV can't play it; 4K/1080p/720p/480p ask Plex to convert. Earlier mode/quality preferences migrate on first read. Debug test intents (`testMode`) still force a delivery mode. Augment Plex's existing HEVC target; competing transcode targets previously forced unnecessary H.264 conversion. A server decision to copy video does not itself prove successful rendering.
- **ADB screenshots can omit HEVC video on this onn while the actual TV displays it. The user confirmed this.** Do not force transcoding based solely on a blank capture. `scripts/check_video.py` has a pixel assertion that can falsely fail for this reason; use playback logs/rendered-frame evidence and physical TV confirmation as appropriate. Never infer universal HDR/codec support from one test.
- Preview thumbnails and intro/credit markers depend on server-generated data. Do not fabricate them.

View file

@ -1,5 +1,11 @@
# Kaleido releases
## 0.1.6
- Replace the separate playback mode and transcode quality settings with one quality list: Original quality (the default), then 4K, 1080p, 720p and 480p. Existing preferences carry over.
- Tapping Left or Right during playback now skips 10 seconds without showing the controls; quick taps add up. Holding Left or Right still opens the timeline for scrubbing.
- Opening the controls straight to the timeline, by holding Left/Right or pressing fast-forward, now keeps focus on the timeline instead of jumping to Play.
## 0.1.5
- Show update download progress on the update button and with a progress bar under it.

View file

@ -63,7 +63,9 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
var downloadProgress by mutableFloatStateOf(0f); private set
/** A verified APK for [update], kept so a cancelled installer can be reopened without downloading again. */
var readyApk by mutableStateOf<File?>(null); private set
var playbackMode by mutableStateOf(preferences.getInt("playbackModeV2",1)); private set
var streamQuality by mutableStateOf(savedStreamQuality()); private set
/** Debug test intents force a delivery mode (0 file, 1 direct stream, 2 convert); never set in release. */
var debugMode by mutableStateOf<Int?>(null); private set
var watchedPercent by mutableStateOf(preferences.getInt("watchedPercent",80).coerceIn(50,100)); private set
var navigationSounds by mutableStateOf(preferences.getBoolean("navigationSounds",true)); private set
var episodeQueue by mutableStateOf(emptyList<Title>());private set
@ -71,7 +73,6 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
var transitioningEpisode by mutableStateOf(false);private set
private var episodeContextJob:Job?=null
private var episodeTransitionJob:Job?=null
var quality by mutableStateOf(preferences.getInt("quality",20000)); private set
private var loadJob: Job? = null
private var initializeJob:Job?=null
private var loadGeneration=0
@ -263,10 +264,12 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
}
}
fun stopPlayback(){playing=null;sectionCache.clear();detailsCache.clear();previews.clear();cancelAnticipation();launchLoad {homeHubs=loadHome();detail?.let {if(it.type in listOf("movie","episode"))detail=api.details(it.id)}}}
fun choosePlaybackMode(value: Int){playbackMode=value;preferences.edit().putInt("playbackModeV2",value).apply()}
// Earlier versions stored a mode (Original/Direct stream/Transcode) and a separate transcode quality.
private fun savedStreamQuality()=preferences.getString("streamQuality",null)?.let{name->StreamQuality.entries.firstOrNull{it.name==name}}
?: if(preferences.getInt("playbackModeV2",1)==2)(if(preferences.getInt("quality",20000)>20000)StreamQuality.UltraHD else StreamQuality.FullHD)else StreamQuality.Original
fun chooseStreamQuality(value: StreamQuality){streamQuality=value;preferences.edit().putString("streamQuality",value.name).apply()}
fun chooseWatchedPercent(value:Int){watchedPercent=value.coerceIn(50,100);preferences.edit().putInt("watchedPercent",watchedPercent).apply()}
fun chooseNavigationSounds(value:Boolean){navigationSounds=value;preferences.edit().putBoolean("navigationSounds",value).apply()}
fun chooseQuality(value: Int){quality=value;preferences.edit().putInt("quality",value).apply()}
fun checkUpdate(manual: Boolean=true){viewModelScope.launch {
if(downloading||!manual&&System.currentTimeMillis()-preferences.getLong("lastUpdateCheck",0)<6*3600_000L)return@launch
updateStatus="Checking for updates…"
@ -287,5 +290,5 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
fun clearDownload(){downloadedApk=null}
/** Back from the system installer without updating: the verified APK can be installed again. */
fun installerReturned(){if(readyApk!=null&&!downloading)updateStatus="Update downloaded. Select Install ${update?.version.orEmpty()} to finish."}
fun debugPlay(id: String,offset: Long,mode: Int){if(!BuildConfig.DEBUG)return;launchLoad {playing=null;delay(150);playbackMode=mode;playing=api.details(id).copy(offset=offset);startFromZero=false}}
fun debugPlay(id: String,offset: Long,mode: Int){if(!BuildConfig.DEBUG)return;launchLoad {playing=null;delay(150);debugMode=mode;playing=api.details(id).copy(offset=offset);startFromZero=false}}
}

View file

@ -54,7 +54,10 @@ class PlaybackController(private val vm: KaleidoViewModel,val item: Title) {
setHandleAudioBecomingNoisy(true)
}
val mediaSession=MediaSession.Builder(app,player).setId("kaleido-${UUID.randomUUID()}").build()
var mode by mutableIntStateOf(vm.playbackMode);private set
// Original quality direct-streams the source video (remuxed, never re-encoded) and falls back
// to conversion if the TV can't play it; a resolution always asks Plex to convert.
var mode by mutableIntStateOf(vm.debugMode ?: if(vm.streamQuality==StreamQuality.Original)1 else 2);private set
val qualityLabel get()=if(mode<2)StreamQuality.Original.label else "Converting · "+vm.streamQuality.conversion.label
var loading by mutableStateOf(true);private set
var error by mutableStateOf<String?>(null);private set
var position by mutableLongStateOf(if(vm.startFromZero)0 else item.offset);private set
@ -115,7 +118,7 @@ class PlaybackController(private val vm: KaleidoViewModel,val item: Title) {
MediaItem.SubtitleConfiguration.Builder(android.net.Uri.parse(api.url(s.key))).setId(s.id).setLabel(s.title).setLanguage(s.language).setMimeType(when(s.codec){"srt"->MimeTypes.APPLICATION_SUBRIP;"ass","ssa"->MimeTypes.TEXT_SSA;else->MimeTypes.TEXT_VTT}).setSelectionFlags(if(s.id==activeSubtitle)C.SELECTION_FLAG_DEFAULT else 0).build()
})
} else {
val p=api.transcodeParams(item,streamSession,mode,offset,vm.quality)
val p=api.transcodeParams(item,streamSession,mode,offset,vm.streamQuality.conversion)
val decision=api.container("/video/:/transcode/universal/decision",p)
if(decision.optInt("generalDecisionCode")>=2000)throw PlexException(decision.optString("generalDecisionText","Server cannot convert this media."))
builder.setUri(api.url("/video/:/transcode/universal/start.m3u8",p)).setMimeType(MimeTypes.APPLICATION_M3U8)
@ -128,10 +131,10 @@ class PlaybackController(private val vm: KaleidoViewModel,val item: Title) {
fun seekTo(target:Long){val clamped=target.coerceIn(0,duration);if(mode>0&&clamped<streamStart){val resume=player.playWhenReady;scope.launch{prepare(mode,clamped,resume)}}else{player.seekTo(clamped);position=clamped;report(if(isPlaying)"playing"else "paused")}}
fun toggle(){if(player.isPlaying)player.pause()else{if(ended)seekTo(0);player.play()}}
fun retry(){scope.launch{prepare(mode,position)}}
fun changeMode(value:Int){val resume=player.playWhenReady;vm.choosePlaybackMode(value);scope.launch{prepare(value,position,resume)}}
fun changeQuality(value:Int){val resume=player.playWhenReady;vm.chooseQuality(value);if(mode>0)scope.launch{prepare(mode,position,resume)}}
fun changeQuality(value:StreamQuality){val resume=player.playWhenReady;vm.chooseStreamQuality(value);scope.launch{prepare(if(value==StreamQuality.Original)1 else 2,position,resume)}}
fun changeSpeed(value:Float){playbackRate=value;player.setPlaybackSpeed(value)}
fun scrubBy(delta:Long){scrubPosition=((scrubPosition ?: position)+delta).coerceIn(0,duration);seekJob?.cancel();seekJob=scope.launch{delay(650);commitScrub()}}
/** Moves the pending seek target; repeated presses accumulate into one seek after [settle] ms. */
fun scrubBy(delta:Long,settle:Long=650){scrubPosition=((scrubPosition ?: position)+delta).coerceIn(0,duration);seekJob?.cancel();seekJob=scope.launch{delay(settle);commitScrub()}}
fun commitScrub(){val target=scrubPosition ?: return;scrubPosition=null;seekTo(target)}
fun pause(){player.pause();position=currentPosition();report("paused")}
fun select(type:Int,groupIndex:Int,trackIndex:Int) {
@ -157,4 +160,14 @@ class PlaybackController(private val vm: KaleidoViewModel,val item: Title) {
}
fun close(){if(closed)return;position=currentPosition();closed=true;scope.cancel();report("stopped",true);reports.close();mediaSession.release();player.release()}
}
/** The single playback quality preference: the original stream, then conversions from highest to lowest resolution. */
enum class StreamQuality(val label:String,val width:Int,val height:Int,val kbps:Int) {
Original("Original quality",0,0,0),
UltraHD("4K · 80 Mbps",3840,2160,80000),
FullHD("1080p · 20 Mbps",1920,1080,20000),
HD("720p · 8 Mbps",1280,720,8000),
SD("480p · 3 Mbps",720,480,3000);
/** Target used when Plex must convert; Original falls back to 1080p if direct streaming fails. */
val conversion get()=if(this==Original)FullHD else this
}
fun clockTime(ms:Long):String {val s=(ms.coerceAtLeast(0)/1000);return if(s>=3600)"%d:%02d:%02d".format(s/3600,s/60%60,s%60)else "%d:%02d".format(s/60,s%60)}

View file

@ -22,14 +22,12 @@ import androidx.compose.ui.unit.sp
import kotlinx.coroutines.delay
@Composable internal fun PlaybackOptions(vm:KaleidoViewModel,controller:PlaybackController,item:Title,menu:Int,open:(Int)->Unit,close:()->Unit) {
val modes=listOf("Original file","Direct stream","Transcode")
val speeds=listOf(.5f,.75f,1f,1.25f,1.5f,2f)
val dismiss={if(menu==3)close()else open(3)}
when(menu) {
3->TrackPanel("Playback options",listOf("Mode · ${modes[controller.mode]}","Audio language","Subtitles","Speed · ${controller.playbackRate}×","Transcode quality", "Chapters"),0,dismiss){index->open(when(index){0->4;1->1;2->2;3->5;4->6;else->7})}
4->TrackPanel("Playback mode",modes,controller.mode,dismiss){controller.changeMode(it);close()}
3->TrackPanel("Playback options",listOf("Quality · ${vm.streamQuality.label}","Audio language","Subtitles","Speed · ${controller.playbackRate}×","Chapters"),0,dismiss){index->open(when(index){0->4;1->1;2->2;3->5;else->7})}
4->TrackPanel("Playback quality",StreamQuality.entries.map{it.label},vm.streamQuality.ordinal,dismiss){controller.changeQuality(StreamQuality.entries[it]);close()}
5->TrackPanel("Playback speed",speeds.map{"${it}×"},speeds.indexOf(controller.playbackRate),dismiss){controller.changeSpeed(speeds[it]);close()}
6->TrackPanel("Transcode quality",listOf("1080p · 20 Mbps","4K · 80 Mbps"),if(vm.quality>20000)1 else 0,dismiss){controller.changeQuality(if(it==0)20000 else 80000);close()}
7->TrackPanel("Chapters",item.chapters.map{"${it.title} · ${clockTime(it.start)}"},item.chapters.indexOfLast{it.start<=controller.position},dismiss){controller.seekTo(item.chapters[it].start);close()}
}
}

View file

@ -57,6 +57,8 @@ import kotlinx.coroutines.delay
var trackMenu by remember{mutableIntStateOf(0)}
var postPlay by remember{mutableStateOf(false)}
var seekFocus by remember{mutableStateOf(false)}
// Set once the timeline takes focus for this reveal, so Play's initial focus can't take it back.
var timelineReveal by remember{mutableStateOf(false)}
var restoreMenuFocus by remember{mutableIntStateOf(0)}
val rootFocus=remember{FocusRequester()}
val timelineFocus=remember{FocusRequester()}
@ -77,8 +79,8 @@ import kotlinx.coroutines.delay
LaunchedEffect(controls,interaction,controller.isPlaying,trackMenu) {
if(controls&&controller.isPlaying&&trackMenu==0){delay(5000);controls=false}
}
LaunchedEffect(controls) {if(!controls){delay(210);runCatching{rootFocus.requestFocus()}}}
LaunchedEffect(seekFocus,controls) {if(seekFocus&&controls){delay(220);runCatching{timelineFocus.requestFocus()};seekFocus=false}}
LaunchedEffect(controls) {if(!controls){timelineReveal=false;delay(210);runCatching{rootFocus.requestFocus()}}}
LaunchedEffect(seekFocus,controls) {if(seekFocus&&controls){delay(220);runCatching{timelineFocus.requestFocus()};timelineReveal=true;seekFocus=false}}
LaunchedEffect(restoreMenuFocus,trackMenu) {if(restoreMenuFocus!=0&&trackMenu==0){delay(16);runCatching{(when(restoreMenuFocus){1->audioFocus;2->subtitleFocus;else->optionsFocus}).requestFocus()};restoreMenuFocus=0}}
fun goBack(){if(postPlay)postPlay=false else if(trackMenu!=0)closeTracks()else if(controls)controls=false else vm.stopPlayback()}
BackHandler(onBack=::goBack)
@ -94,7 +96,16 @@ import kotlinx.coroutines.delay
android.view.KeyEvent.KEYCODE_MEDIA_FAST_FORWARD->{controller.seekTo(controller.position+30000);controls=true;seekFocus=true;true}
android.view.KeyEvent.KEYCODE_MEDIA_REWIND->{controller.seekTo(controller.position-10000);controls=true;seekFocus=true;true}
android.view.KeyEvent.KEYCODE_DPAD_CENTER,android.view.KeyEvent.KEYCODE_ENTER->{if(!visible){controls=true;true}else false}
android.view.KeyEvent.KEYCODE_DPAD_LEFT,android.view.KeyEvent.KEYCODE_DPAD_RIGHT->{if(!visible){controller.scrubBy(if(event.nativeKeyEvent.keyCode==android.view.KeyEvent.KEYCODE_DPAD_LEFT)-10000 else 10000);controls=true;seekFocus=true;true}else false}
android.view.KeyEvent.KEYCODE_DPAD_LEFT,android.view.KeyEvent.KEYCODE_DPAD_RIGHT->{
val delta=if(event.nativeKeyEvent.keyCode==android.view.KeyEvent.KEYCODE_DPAD_LEFT)-10000L else 10000L
when {
// A tap skips without revealing anything; quick taps add up into one seek.
!visible&&event.nativeKeyEvent.repeatCount==0->{controller.scrubBy(delta,settle=350);true}
// Holding reveals the timeline and keeps scrubbing until it takes focus.
!visible||seekFocus->{controller.scrubBy(delta);controls=true;seekFocus=true;true}
else->false
}
}
android.view.KeyEvent.KEYCODE_DPAD_UP,android.view.KeyEvent.KEYCODE_DPAD_DOWN->{if(!visible){controls=true;seekFocus=event.nativeKeyEvent.keyCode==android.view.KeyEvent.KEYCODE_DPAD_UP;true}else false}
else->false
}
@ -115,7 +126,7 @@ import kotlinx.coroutines.delay
Row(Modifier.fillMaxWidth().padding(bottom=7.dp),verticalAlignment=Alignment.Bottom) {
Text(item.displayTitle,color=Accent,fontSize=18.sp,lineHeight=23.sp,fontWeight=FontWeight.SemiBold,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f))
Spacer(Modifier.width(18.dp))
Text(if(item.type=="episode")"S${item.parentIndex} · E${item.index} ${item.title}"else listOf("Original","Direct stream","Transcoding")[controller.mode],color=Color.White.copy(alpha=.62f),fontSize=10.sp,lineHeight=15.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.widthIn(max=350.dp))
Text(if(item.type=="episode")"S${item.parentIndex} · E${item.index} ${item.title}"else controller.qualityLabel,color=Color.White.copy(alpha=.62f),fontSize=10.sp,lineHeight=15.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.widthIn(max=350.dp))
}
SeekTimeline(controller,item,Modifier.fillMaxWidth().focusRequester(timelineFocus).focusProperties{down=playFocus},::interacted)
Box(Modifier.fillMaxWidth().height(40.dp)) {
@ -125,7 +136,7 @@ import kotlinx.coroutines.delay
}
Row(Modifier.align(Alignment.Center),verticalAlignment=Alignment.CenterVertically,horizontalArrangement=Arrangement.spacedBy(16.dp)) {
IconControl(Icons.Outlined.Replay10,"Back 10 seconds",size=32.dp,iconSize=22.dp,modifier=Modifier.focusProperties{up=timelineFocus},onFocused=::interacted){controller.seekTo(controller.position-10000);interacted()}
IconControl(if(controller.isPlaying)Icons.Filled.Pause else Icons.Filled.PlayArrow,if(controller.isPlaying)"Pause"else "Play",size=38.dp,iconSize=28.dp,requester=playFocus,initialFocus=controls&&!seekFocus,modifier=Modifier.focusProperties{up=timelineFocus},onFocused=::interacted){controller.toggle();controls=true;interacted()}
IconControl(if(controller.isPlaying)Icons.Filled.Pause else Icons.Filled.PlayArrow,if(controller.isPlaying)"Pause"else "Play",size=38.dp,iconSize=28.dp,requester=playFocus,initialFocus=controls&&!seekFocus&&!timelineReveal,modifier=Modifier.focusProperties{up=timelineFocus},onFocused=::interacted){controller.toggle();controls=true;interacted()}
IconControl(Icons.Outlined.Forward30,"Forward 30 seconds",size=32.dp,iconSize=22.dp,modifier=Modifier.focusProperties{up=timelineFocus},onFocused=::interacted){controller.seekTo(controller.position+30000);interacted()}
}
Row(Modifier.align(Alignment.CenterEnd),verticalAlignment=Alignment.CenterVertically,horizontalArrangement=Arrangement.spacedBy(10.dp)) {

View file

@ -96,12 +96,12 @@ class PlexApi(val clientId: String) {
request(url("/library/parts/${part.id}",buildMap { put("allParts","1");audio?.let {put("audioStreamID",it)};subtitle?.let {put("subtitleStreamID",it)} }),method="PUT")
}
fun image(path: String, width: Int = 600, height: Int = 900): String? = if(path.isBlank() || session==null) null else url("/photo/:/transcode",mapOf("url" to path,"width" to width.toString(),"height" to height.toString(),"minSize" to "1","upscale" to "0"))
fun transcodeParams(item: Title, sessionId: String, mode: Int, offset: Long, quality: Int): Map<String,String> = buildMap {
fun transcodeParams(item: Title, sessionId: String, mode: Int, offset: Long, quality: StreamQuality): Map<String,String> = buildMap {
put("path",item.key);put("mediaIndex","0");put("partIndex","0");put("protocol","hls");put("session",sessionId);put("offset",(offset/1000.0).toString())
put("directPlay","0");put("directStream",if(mode==1) "1" else "0");put("directStreamAudio","1");put("directStreamVideo",if(mode==1) "1" else "0")
val original=item.media.firstOrNull()
put("maxVideoBitrate",if(mode==1)maxOf(original?.bitrate ?: 0,100000).toString()else quality.toString())
put("videoResolution",if(mode==1&&original!=null&&original.width>0)"${original.width}x${original.height}"else if(quality>20000)"3840x2160"else "1920x1080")
put("maxVideoBitrate",if(mode==1)maxOf(original?.bitrate ?: 0,100000).toString()else quality.kbps.toString())
put("videoResolution",if(mode==1&&original!=null&&original.width>0)"${original.width}x${original.height}"else "${quality.width}x${quality.height}")
put("videoQuality","100");put("audioBoost","100");put("subtitleSize","100");put("location","lan");put("hasMDE","1");put("fastSeek","1")
put("X-Plex-Client-Identifier",clientId);put("X-Plex-Product","Kaleido");put("X-Plex-Platform","Android");put("X-Plex-Device","Android TV")
// Augment the existing target. Separate targets make Plex prefer H.264 conversion even for HEVC it could copy.

View file

@ -141,7 +141,7 @@ val sortLabels=listOf("titleSort:asc" to "Title: A–Z","titleSort:desc" to "Tit
Column(Modifier.fillMaxSize().padding(60.dp),verticalArrangement=Arrangement.spacedBy(18.dp)){Brand();Spacer(Modifier.height(20.dp));Text("Choose your Plex server",color=Color.White,fontSize=32.sp,fontWeight=FontWeight.Bold);vm.servers.forEachIndexed{i,s->TvButton(s.name,initialFocus=i==0,onClick={vm.chooseServer(s)})}}
}
@Composable fun SettingsScreen(vm: KaleidoViewModel,install: (File)->Unit) {
var confirmSignOut by remember{mutableStateOf(false)};var modeDialog by remember{mutableStateOf(false)};var qualityDialog by remember{mutableStateOf(false)};var watchedDialog by remember{mutableStateOf(false)}
var confirmSignOut by remember{mutableStateOf(false)};var qualityDialog by remember{mutableStateOf(false)};var watchedDialog by remember{mutableStateOf(false)}
LaunchedEffect(vm.downloadedApk){vm.downloadedApk?.let(install)}
// Returning from the package installer can leave nothing focused; the next D-pad press
// would then search from the top bar and open Home. Put focus back on the update actions.
@ -160,7 +160,10 @@ val sortLabels=listOf("titleSort:asc" to "Title: A–Z","titleSort:desc" to "Tit
LazyColumn(Modifier.onFocusChanged{settingsFocused=it.hasFocus},contentPadding=PaddingValues(horizontal=Cinema.gutter,vertical=17.dp),verticalArrangement=Arrangement.spacedBy(16.dp)) {
item {Text("Settings",color=Accent,fontSize=29.sp,lineHeight=34.sp,fontWeight=FontWeight.SemiBold,letterSpacing=(-.8).sp)}
item{SettingsPanel("Plex connection") {Text(vm.session?.serverName.orEmpty(),color=Color.White,fontSize=20.sp,fontWeight=FontWeight.Bold);Text(if(vm.accountToken.isBlank())"Server connection · Link your Plex account to discover your servers"else "Plex account linked · Session encrypted with Android Keystore",color=Muted,fontSize=12.sp);Spacer(Modifier.height(14.dp));Row(horizontalArrangement=Arrangement.spacedBy(10.dp)){TvButton("Sign in with Plex",initialFocus=true,onClick={vm.beginAccountLink()});if(vm.accountToken.isNotBlank())TvButton("Choose server",onClick={vm.switchServer()});TvButton("Sign out",onClick={confirmSignOut=true})}}}
item{SettingsPanel("Playback") {Row(horizontalArrangement=Arrangement.spacedBy(12.dp)){TvButton("Mode: "+listOf("Original","Direct stream","Transcode")[vm.playbackMode],onClick={modeDialog=true});TvButton("Transcode quality: "+if(vm.quality>20000)"4K · 80 Mbps"else "1080p · 20 Mbps",onClick={qualityDialog=true})};Text("Direct stream is the default. Playback mode, audio, subtitles, speed, and quality can also be changed in the player.",color=Muted,fontSize=12.sp,modifier=Modifier.padding(top=12.dp))}}
item{SettingsPanel("Playback") {
TvButton("Quality: "+vm.streamQuality.label,onClick={qualityDialog=true})
Text("Original quality plays the source video without conversion and is the default. A resolution asks Plex to convert, which helps on slower connections. Quality, audio, subtitles and speed can also be changed in the player.",color=Muted,fontSize=12.sp,lineHeight=18.sp,modifier=Modifier.padding(top=10.dp))
}}
item{SettingsPanel("Watched status") {
TvButton("Mark watched at ${vm.watchedPercent}%",onClick={watchedDialog=true})
Text("A resumed title gets its checkmark at this playback percentage. Completed titles keep their Plex watched status.",color=Muted,fontSize=12.sp,lineHeight=18.sp,modifier=Modifier.padding(top=10.dp))
@ -197,8 +200,7 @@ val sortLabels=listOf("titleSort:asc" to "Title: A–Z","titleSort:desc" to "Tit
val thresholds=listOf(50,60,70,75,80,85,90,95,100)
ChoiceDialog("Mark watched after",thresholds.map{"$it%"},thresholds.indexOf(vm.watchedPercent),{watchedDialog=false}){vm.chooseWatchedPercent(thresholds[it]);watchedDialog=false}
}
if(modeDialog)ChoiceDialog("Playback mode",listOf("Automatic · Original quality","Direct stream · Remux when possible","Transcode · Compatibility mode"),vm.playbackMode,{modeDialog=false}){vm.choosePlaybackMode(it);modeDialog=false}
if(qualityDialog)ChoiceDialog("Transcode quality",listOf("1080p · 20 Mbps","4K · 80 Mbps"),if(vm.quality>20000)1 else 0,{qualityDialog=false}){vm.chooseQuality(if(it==0)20000 else 80000);qualityDialog=false}
if(qualityDialog)ChoiceDialog("Playback quality",StreamQuality.entries.map{it.label},vm.streamQuality.ordinal,{qualityDialog=false}){vm.chooseStreamQuality(StreamQuality.entries[it]);qualityDialog=false}
}
/** Scroll only as far as needed to reveal the focused control, keeping [margin] px clear of the edges. */
private class MinimalScroll(private val margin:Float):BringIntoViewSpec {

Binary file not shown.

View file

@ -1 +1 @@
4831f17cb8e6c08254707bd66c1e210bc8e6d46fe112436bd8cfe7d2f629086c Kaleido.apk
7b74562e9424ef4707e7e80ccf831610e4efa80a0879109b63074738c6195a88 Kaleido.apk

View file

@ -1,7 +1,7 @@
{
"version": "0.1.5",
"versionCode": 6,
"url": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.1.5/distribution/Kaleido.apk",
"checksumUrl": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.1.5/distribution/Kaleido.apk.sha256",
"notes": "- Show update download progress on the update button and with a progress bar under it.\n- Keep focus on the update button while it downloads and after the installer closes, so the remote no longer jumps to Home from Settings.\n- Offer Install again after the installer is cancelled, without downloading the update again.\n- Stop Settings from scrolling when moving between buttons, show only the new version's notes above the update buttons, and make focused primary buttons clearly stand out."
"version": "0.1.6",
"versionCode": 7,
"url": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.1.6/distribution/Kaleido.apk",
"checksumUrl": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.1.6/distribution/Kaleido.apk.sha256",
"notes": "- Replace the separate playback mode and transcode quality settings with one quality list: Original quality (the default), then 4K, 1080p, 720p and 480p. Existing preferences carry over.\n- Tapping Left or Right during playback now skips 10 seconds without showing the controls; quick taps add up. Holding Left or Right still opens the timeline for scrubbing.\n- Opening the controls straight to the timeline, by holding Left/Right or pressing fast-forward, now keeps focus on the timeline instead of jumping to Play."
}

View file

@ -30,7 +30,7 @@ The interface gives artwork priority. App chrome uses neutral near-black, charco
Controls occupy a shallow bottom gradient. A compact title, slim timeline, small time labels, central transport icons, and right-aligned track icons replace the rectangular button grid. The timeline is a true D-pad focus target: Up from transport reaches it, Left/Right seek, and Down returns to Play/Pause. Holding a direction increases the seek step. Dedicated media keys remain supported.
The controls fade and slide away after five seconds during playback. OK reveals them; Back hides them before exiting. Audio and subtitle panels open above their icons and restore focus when dismissed. A gear exposes playback mode, audio, subtitles, speed, transcode quality, and chapters. Direct stream is the saved default. The timeline includes buffered progress and server-generated video/chapter previews. Skip actions have opaque contrast surfaces.
The controls fade and slide away after five seconds during playback. While they are hidden, a Left/Right tap skips 10 seconds without revealing anything (quick taps add up into one seek), and holding Left/Right reveals the focused timeline for scrubbing. OK and Down reveal them; Back hides them before exiting. Audio and subtitle panels open above their icons and restore focus when dismissed. A gear exposes quality, audio, subtitles, speed, and chapters. Quality is one list shared with Settings: Original quality (the default, direct stream of the source video), then 4K, 1080p, 720p and 480p conversions. The timeline includes buffered progress and server-generated video/chapter previews. Skip actions have opaque contrast surfaces.
Episode endings and Skip credits open a five-second, cancellable next-episode countdown with season episodes and related shows. Each player session has a unique Media3 session ID so overlapping Compose disposal and next-episode creation cannot collide.

View file

@ -112,3 +112,9 @@ The user found that pressing "Download & install" on the Fire Stick appeared to
The update action now stays in place and reports progress ("Downloading… n%" plus a progress bar), then offers "Install" for the verified APK, which reopens the installer without downloading again. Returning from the installer refreshes the status and restores focus to the update actions if nothing is focused. Settings scrolls only far enough to keep the focused control 56 dp from the edges, and shows only the new version's notes above the buttons. `publish_release.py` and `package_release.py` publish just the version's changelog section; `releaseNotes()` trims older full-changelog bodies, with unit coverage.
Verified on the Fire Stick with a build labelled 0.1.3 against published 0.1.4: check, download, installer, Back, then Left/Up/Down/Right all stayed within Settings with focus on "Install 0.1.4". The LAN download takes under a second, so a throwaway build that slowed the download loop (not committed) was used to capture "Downloading… 8%" with the progress bar. Completing the in-app update itself was left to the user.
## Quality setting and silent skips - 2026-10-24
Playback mode and transcode quality are now one `StreamQuality` preference: Original quality (direct stream of the source video, falling back to a 1080p conversion) and 4K/1080p/720p/480p conversions, in Settings and the player gear. Earlier `playbackModeV2`/`quality` preferences migrate on first read. With the controls hidden, a Left/Right tap now only moves a pending seek (350 ms settle, so quick taps add up); a key repeat reveals the controls with the timeline focused. Play's initial focus no longer takes focus back after a timeline reveal.
On the onn, `verify_ui.py player` passed all seven checks, including two new ones: a Right tap skipped at least 9 s (projected from the Android media-session position) with no controls, and `input keyevent --longpress 22` revealed the focused timeline. `repro_runtime.py controls` passed. While video plays with controls visible, their clock updates keep `uiautomator` from dumping and it silently returns the previous hierarchy; the player checks now wait for the `READY` log line before pausing and inspect the screen while paused. A focus-loss theory based on those stale dumps was ruled out with a temporary focus log.

View file

@ -16,10 +16,18 @@ def sections():
key(21);wait(lambda r:'Recently released' in labels(r),'Cached Movies must return');focused('Movies')
print('PASS startup tab switch, TV loading, and cached section return')
def ready(item,timeout=45):
# A pause sent while the player is still preparing is overridden when playback starts.
deadline=time.monotonic()+timeout
while time.monotonic()<deadline:
if f'READY item={item}' in adb('logcat','-d','-s','KaleidoPlayback:I').decode(errors='replace'):time.sleep(1);return
time.sleep(.5)
raise AssertionError(f'Playback of {item} never became ready')
def controls():
adb('shell','am','force-stop','tv.kaleido.app')
adb('shell','am','force-stop','tv.kaleido.app');adb('logcat','-c')
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId','7599','--el','testOffset','90000','--ei','testMode','1')
time.sleep(9);key(127);focused('Play')
ready(7599);key(127);focused('Play')
screenshot('direct-stream-episode')
key(4);wait(lambda r:not labels(r),'One Back must hide controls rather than only clearing focus')
key(23);focused('Play');key(126);time.sleep(6)

View file

@ -61,10 +61,23 @@ def browse():
capture('plex-sign-in');key(4);text('Settings');key(4);focused('Home')
passed('Plex account linking obtains a real PIN and cancellation preserves the session')
def position():
# Live media-session position: the reported one is as of its last update, so project it to now.
out=adb('shell','dumpsys','media_session').decode(errors='replace')
match=re.search(r'package=tv\.kaleido\.app.*?PlaybackState \{state=(\w+)\(\d+\), position=(\d+).*?speed=([\d.]+), updated=(\d+)',out,re.S)
assert match,'Kaleido media session not found'
now=float(adb('shell','cat','/proc/uptime').decode().split()[0])*1000
state,at,speed,updated=match.group(1),int(match.group(2)),float(match.group(3)),int(match.group(4))
return int(at+(now-updated)*speed) if state=='PLAYING' else at
def player():
adb('shell','am','force-stop','tv.kaleido.app')
adb('shell','am','force-stop','tv.kaleido.app');adb('logcat','-c')
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId','9776','--el','testOffset','90000','--ei','testMode','2')
time.sleep(12);key(127);focused('Play');capture('player')
# A pause sent while the player is still preparing is overridden when playback starts.
deadline=time.monotonic()+45
while 'READY item=9776' not in adb('logcat','-d','-s','KaleidoPlayback:I').decode(errors='replace'):
assert time.monotonic()<deadline,'Playback never became ready';time.sleep(.5)
time.sleep(1);key(127);focused('Play');capture('player')
passed('Compact player controls over actual video')
key(19);focused('Playback timeline');key(22);capture('timeline');key(20);focused('Play')
passed('D-pad Up focuses timeline, Right seeks, Down returns to play')
@ -74,14 +87,24 @@ def player():
key(4);focused('Subtitles');key(22);focused('Playback options');key(23);text('Playback options')
key(20,3);focused('Speed');key(23);text('Playback speed');focused('1.0×');key(20);focused('1.25×');key(23)
focused('Playback options');key(23);text('Speed · 1.25×');key(4);focused('Playback options')
key(23);text('Playback options');key(23);text('Playback mode');focused('Transcode');key(19);focused('Direct stream');key(23)
focused('Playback options');time.sleep(5);key(23);text('Mode · Direct stream');key(4);focused('Playback options')
passed('Player gear changes speed and Direct stream while retaining focus')
key(23);text('Playback options');key(23);text('Playback quality');focused('Original quality');key(20);focused('4K');key(19);focused('Original quality');key(23)
focused('Playback options');time.sleep(5);key(23);text('Quality · Original quality');key(4);focused('Playback options')
passed('Player gear changes speed and switches a conversion to Original quality while retaining focus')
key(4)
wait(lambda r:focus(r)=='' and '2 Fast 2 Furious' not in labels(r),'Controls hidden by Back')
key(23);focused('Play');key(126);time.sleep(6)
wait(lambda r:'2 Fast 2 Furious' not in labels(r),'Controls auto-hide during playback')
passed('OK reveals controls; Back and playback timer hide them')
# Pause first: visible controls update their clock while playing, which keeps uiautomator from
# dumping a fresh hierarchy. A Right tap skips 10 s without revealing controls; holding reveals
# the timeline.
key(127);focused('Play');key(4);wait(lambda r:focus(r)=='' and '2 Fast 2 Furious' not in labels(r),'Controls hidden while paused')
before=position();key(22);time.sleep(1.5)
assert '2 Fast 2 Furious' not in labels(snapshot()),'A tap must not reveal controls'
assert position()-before>=9000,'A tap must skip forward 10 seconds'
adb('shell','input','keyevent','--longpress','22');focused('Playback timeline')
passed('Left/Right taps skip silently; holding reveals the timeline')
key(4);wait(lambda r:'2 Fast 2 Furious' not in labels(r),'Back hides controls')
key(4);text('Continue Watching');passed('Back exits playback to live home')
if __name__=='__main__':

View file

@ -1,2 +1,2 @@
versionName=0.1.5
versionCode=6
versionName=0.1.6
versionCode=7