Compare commits

...

2 commits
v0.7.0 ... main

Author SHA1 Message Date
34f54bcc29 Release Kaleido 0.8.1 fixing Down from a title page's buttons
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m32s
- A row below the header (Seasons, Cast, search results) attached its
  entry focus target to its first card. Once the row was scrolled away,
  e.g. a show page's restored Seasons scroll, that card was not composed,
  so Down from the actions failed and focus stayed in the header.
- Enter at the preferred card while it is in view, otherwise at the first
  fully visible card (rowEntryIndex, with JVM tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 12:11:26 -07:00
3e020bd7fa Release Kaleido 0.8.0 with a single-countdown Up Next screen
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m33s
- Credits and episode endings open Up Next: the video keeps playing in a
  top-left mini-player beside the next episode, season and related shows.
  Play next episode carries the only countdown; any remote press stops it.
  Left then OK on the video, or Back, returns to the credits.
- Wait for the player's final timeline report before reloading Home, so
  Continue Watching reflects the episode just watched.
- Remove the source label above Home's featured title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 21:48:11 -07:00
19 changed files with 271 additions and 86 deletions

View file

@ -55,8 +55,8 @@ Run only checks relevant to the change. Live playback tests change real Plex pro
| `scripts/repro_runtime.py browse` | Horizontal bounds and frame pacing; **optimized release with profile compilation** |
| `scripts/repro_runtime.py controls` | One-press Back, OK reveal, timed hide and exit; **debug** |
| `scripts/repro_runtime.py episode` | Next-episode replacement/crash regression; **debug** |
| `scripts/repro_runtime.py postplay` | Natural ending → five-second countdown → next episode READY; **debug** |
| `scripts/repro_runtime.py credits` | Visible Skip credits, season/related rows and cancellable countdown; **debug** |
| `scripts/repro_runtime.py postplay` | Natural ending → Up Next countdown → next episode READY; **debug** |
| `scripts/repro_runtime.py credits` | Credits → Up Next (mini-player), season/related rows, any-press cancel, Back to video; **debug** |
| `scripts/device.py screenshot <name>` | Capture to ignored `evidence/private/`; also supports `hierarchy`, `logs`, `launch`, `key` |
| `scripts/profile_browse.py` | Targeted atrace investigation when navigation performance regresses |
| `scripts/profile_transitions.py <label>` | Skipped frames per D-pad transition (tabs, hero, rows, Movies) from framestats; first cycle is the first pass after launch; profiled **release**; raw frames kept for `resummarize` |

View file

@ -1,5 +1,15 @@
# Kaleido releases
## 0.8.1
- Fix a title page where Down from the buttons did nothing, leaving you stuck at the top. This happened when the Seasons, Cast or another row below had been scrolled away from its first card, for example by reopening a show from Continue Watching. Down now moves to a card in view.
## 0.8.0
- Replace the two countdowns at the end of an episode with one Up Next screen. When the credits start, the video shrinks into the top-left corner and keeps playing, beside the next episode's artwork, details, rating and synopsis, with the rest of the season and related shows below. Play next episode fills as it counts down, and pressing any button on the remote stops the countdown. Press Left and select the video, or press Back, to return to the credits.
- Update Continue Watching as soon as you leave the player, including an episode you have just started.
- Remove the label above the featured title on Home ("Recently released", "Suggested for you" and similar), as in Kaleido Desktop.
## 0.7.0
- Add a Previous episode button to the player, and redesign its controls: elapsed and remaining time at the ends of the timeline, previous episode, back 10 seconds, play, forward 30 seconds and next episode grouped in the centre, and the finish time beside Exit. Previous episode also steps back through a shuffle.

View file

@ -111,14 +111,29 @@ import androidx.compose.ui.text.input.TextFieldValue
// A reopened episode page resets its selection, but its saved scroll can still
// point elsewhere. Compose the entry card before the header sends focus Down.
LaunchedEffect(rowId){if(initialItem!=null)row.scrollToItem((initial-1).coerceAtLeast(0))}
val entryIndex=if(entryFocus!=null)rememberRowEntry(row,entry).value else -1
Column {
Box(Modifier.padding(horizontal=Cinema.gutter)){SectionHeading(title,subtitle)}
LazyRow(state=row,contentPadding=PaddingValues(start=Cinema.gutter,end=Cinema.gutter,top=5.dp,bottom=5.dp),horizontalArrangement=Arrangement.spacedBy(if(landscape)13.dp else 12.dp),modifier=Modifier.focusRestorer(fallback=entryFocus ?: FocusRequester.Default)) {
itemsIndexed(items,key={_,it->it.id}){index,item->MediaTile(vm,item,"$rowId:${item.id}",landscape,modifier=(if(index==entry&&entryFocus!=null)Modifier.focusRequester(entryFocus)else Modifier).then(if(up!=null)Modifier.focusProperties{this.up=up}else Modifier),onMove={anticipateTileMove(vm,items,index,it,0)},episodeTitle=episodeTitles,current=item.id==selectedItem,onFocused=onFocused,onClick=onClick)}
itemsIndexed(items,key={_,it->it.id}){index,item->MediaTile(vm,item,"$rowId:${item.id}",landscape,modifier=(if(index==entryIndex&&entryFocus!=null)Modifier.focusRequester(entryFocus)else Modifier).then(if(up!=null)Modifier.focusProperties{this.up=up}else Modifier),onMove={anticipateTileMove(vm,items,index,it,0)},episodeTitle=episodeTitles,current=item.id==selectedItem,onFocused=onFocused,onClick=onClick)}
}
}
}
/**
* The card a row is entered at from above: [preferred] while it is in view, otherwise the first
* card fully in view. A card scrolled out of a lazy row (e.g. a restored or scrolled Seasons row)
* is not composed, so an explicit focus move to its requester fails and strands focus above.
*/
internal fun rowEntryIndex(preferred:Int,visible:List<LazyListItemInfo>,viewportStart:Int):Int {
if(visible.isEmpty()||visible.any{it.index==preferred})return preferred
return (visible.firstOrNull{it.offset>=viewportStart} ?: visible.first()).index
}
/** [rowEntryIndex], updated only when a card enters or leaves the row's view. */
@Composable internal fun rememberRowEntry(row:LazyListState,preferred:Int):State<Int> =
remember(row,preferred){derivedStateOf{row.layoutInfo.let{rowEntryIndex(preferred,it.visibleItemsInfo,it.viewportStartOffset)}}}
internal fun anticipateTileMove(vm:KaleidoViewModel,items:List<Title>,index:Int,direction:Key,columns:Int) {
val target=when(direction){
Key.DirectionLeft->if(columns==0||index%columns>0)index-1 else -1

View file

@ -660,8 +660,6 @@ internal fun runtimeLabel(ms:Long):String {val minutes=(ms/60000).coerceAtLeast(
val metadata by produceState(item,item.id){value=item;value=vm.previewDetails(item)}
Column {
val parts=copyParts(3)
Eyebrow(feature.reason)
Spacer(Modifier.height(9.dp))
TitleIdentity(vm.api,item,Modifier.width(264.dp).height(80.dp))
if(parts>=2)Row(Modifier.fillMaxWidth().padding(top=8.dp,bottom=8.dp),verticalAlignment=Alignment.CenterVertically) {
Text(listOf(item.year,item.genres.firstOrNull().orEmpty(),item.contentRating).filter{it.isNotBlank()}.joinToString(" · "),color=Cinema.secondary,fontSize=10.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f,fill=false))

View file

@ -1,6 +1,6 @@
package tv.kaleido.app
data class HomeFeature(val item:Title,val reason:String)
data class HomeFeature(val item:Title)
/** Interleave discovery categories; Continue Watching has its own rail. */
internal fun homeFeatures(recent:List<Title>,rated:List<Title>,hubs:List<Hub>,continuing:List<Title>,random:kotlin.random.Random=kotlin.random.Random.Default):List<HomeFeature> {
@ -9,10 +9,10 @@ internal fun homeFeatures(recent:List<Title>,rated:List<Title>,hubs:List<Hub>,co
item.id !in excluded&&!item.fullyWatched&&item.offset==0L
// Shuffle movies and shows together rather than always leading with the same movie section.
val buckets=listOf(
recent.filter{eligible(it)&&it.releaseDate.isNotBlank()}.sortedByDescending{it.releaseDate}.take(18).shuffled(random).map{HomeFeature(it,"Recently released")},
rated.filter{eligible(it)&&it.viewedLeafCount==0}.shuffled(random).map{HomeFeature(it,"Highly rated · Unwatched")},
recent.filter{eligible(it)&&it.releaseDate.isNotBlank()}.sortedByDescending{it.releaseDate}.take(18).shuffled(random).map{HomeFeature(it)},
rated.filter{eligible(it)&&it.viewedLeafCount==0}.shuffled(random).map{HomeFeature(it)},
hubs.filterNot{h->listOf("continue","ondeck","inprogress","recentlyviewed","recentlyadded","recentlyaired","recent").any{h.id.contains(it,true)}}
.flatMap{it.items}.filter(::eligible).distinctBy{it.id}.shuffled(random).map{HomeFeature(it,"Suggested for you")}
.flatMap{it.items}.filter(::eligible).distinctBy{it.id}.shuffled(random).map{HomeFeature(it)}
)
val seen=mutableSetOf<String>()
return buildList {

View file

@ -39,6 +39,7 @@ private const val SyncQuietMillis=2000L
internal const val AutoSkipDefaultSeconds=5
/** Returning to Kaleido checks the server almost at once, so watching elsewhere shows up promptly. */
private const val ResumeSyncDelayMillis=750L
private const val PlaybackReportWaitMillis=4_000L
class KaleidoViewModel(app: Application): AndroidViewModel(app) {
val application = app as KaleidoApplication
val api = application.api
@ -742,6 +743,9 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
if(playing?.id!=item.id)return
stopPlayback();fail(message){play(item)}
}
/** Each player's timeline reporter, until it has sent its final position. */
private val playbackReports=java.util.concurrent.CopyOnWriteArraySet<Job>()
internal fun trackPlaybackReports(job:Job){playbackReports+=job;job.invokeOnCompletion{playbackReports-=job}}
fun stopPlayback(){
val finished=playing
shuffleEpisodes=null
@ -749,6 +753,9 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
// A season or episode page shows the last episode played, with fresh progress in its row.
detail?.let{if(finished?.type=="episode"&&it.type in listOf("season","episode"))episodeSelections[it.id]=finished.id}
launchLoad {
// The player closes after this frame and only then reports where it stopped. Reloading
// before Plex has that report showed the previous Continue Watching.
kotlinx.coroutines.withTimeoutOrNull(PlaybackReportWaitMillis){playbackReports.toList().forEach{it.join()}}
homeHubs=loadHome()
detail?.let {
if(it.type in listOf("movie","episode"))detail=api.details(it.id)

View file

@ -129,6 +129,7 @@ class PlaybackController(private val vm: KaleidoViewModel,val item: Title) {
}
}
init {
vm.trackPlaybackReports(reportJob)
audit?.let{player.addAnalyticsListener(it)}
// Sparse diagnostics also survive in release logcat when an intermittent dropout occurs.
player.addAnalyticsListener(object:androidx.media3.exoplayer.analytics.AnalyticsListener {

View file

@ -23,6 +23,15 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.currentStateAsState
import kotlinx.coroutines.delay
import androidx.compose.material3.Icon
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.input.key.KeyEventType
import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.input.key.type
@Composable internal fun PlaybackOptions(vm:KaleidoViewModel,controller:PlaybackController,item:Title,menu:Int,open:(Int)->Unit,close:()->Unit) {
val speeds=listOf(.5f,.75f,1f,1.25f,1.5f,2f)
@ -46,52 +55,142 @@ import kotlinx.coroutines.delay
internal fun speedLabel(speed:Float)=if(speed==1f)"Normal" else "${speed.toString().removeSuffix(".0")}×"
@Composable internal fun PostPlayScreen(vm:KaleidoViewModel,item:Title,dismiss:()->Unit,next:()->Unit) {
/** Where the playing video shrinks to while Up Next is open, on the 960 × 540 dp canvas. */
internal object UpNextFrame {
val x=44.dp;val y=34.dp;val width=352.dp;val height=198.dp
}
/**
* Up Next's page beneath the player's surface: the next episode's artwork, top-right, fading into
* the page, and a black frame under the mini-player for letterboxed video. Drawn before the
* PlayerView, whose SurfaceView shows through only where nothing is drawn above it.
*/
@Composable internal fun UpNextBackdrop(vm:KaleidoViewModel,item:Title,modifier:Modifier) {
val upcoming=vm.followingEpisode(item)
// Settings › Playback sets the countdown; 0 turns autoplay off.
val countdown=if(vm.shuffling&&vm.autoplaySeconds==0)5 else vm.autoplaySeconds
var autoplay by remember{mutableStateOf(countdown>0)}
var seconds by remember{mutableIntStateOf(countdown)}
// The countdown runs only while Kaleido is on screen; leaving it restarts on return.
val lifecycle by LocalLifecycleOwner.current.lifecycle.currentStateAsState()
val onScreen=lifecycle.isAtLeast(Lifecycle.State.STARTED)
LaunchedEffect(autoplay,upcoming?.id,onScreen) {
if(autoplay&&onScreen&&upcoming!=null&&countdown>0){seconds=countdown;android.util.Log.i("KaleidoPlayback","AUTOPLAY countdown item=${item.id} next=${upcoming.id}");repeat(countdown){delay(1000);seconds--};android.util.Log.i("KaleidoPlayback","AUTOPLAY starting next=${upcoming.id}");next()}
}
val season=vm.episodeQueue.filter{it.parentId==item.parentId}
LazyColumn(Modifier.fillMaxSize().background(Color.Black.copy(alpha=.93f)),contentPadding=PaddingValues(horizontal=Cinema.gutter,vertical=29.dp),verticalArrangement=Arrangement.spacedBy(15.dp)) {
item {
Text(if(vm.shuffling)"Up next · Shuffle"else if(upcoming!=null)"Up next"else "More to watch",color=Accent,fontSize=25.sp,fontWeight=FontWeight.SemiBold)
Row(Modifier.padding(top=13.dp),horizontalArrangement=Arrangement.spacedBy(20.dp),verticalAlignment=Alignment.CenterVertically) {
if(upcoming!=null)Artwork(vm.api,upcoming.still.ifBlank{upcoming.thumb},Modifier.width(205.dp).aspectRatio(16f/9f).clip(RoundedCornerShape(5.dp)),480,270,animate=false)
Column(Modifier.weight(1f)) {
Text(upcoming?.displayTitle ?: item.displayTitle,color=Accent,fontSize=21.sp,fontWeight=FontWeight.SemiBold)
Text(upcoming?.let{"S${it.parentIndex} · E${it.index} ${it.title}"} ?: "You've reached the end of this series.",color=Cinema.secondary,fontSize=12.sp,modifier=Modifier.padding(top=5.dp,bottom=15.dp))
Row(horizontalArrangement=Arrangement.spacedBy(10.dp),verticalAlignment=Alignment.CenterVertically) {
if(upcoming!=null)ActionButton(if(vm.transitioningEpisode)"Loading…"else if(autoplay)"Play in $seconds"else "Play now",Icons.Filled.PlayArrow,modifier=Modifier.onFocusChanged{if(it.isFocused&&BuildConfig.DEBUG)android.util.Log.i("KaleidoPlayback","POSTPLAY focus=play")},primary=true,initialFocus=true){autoplay=false;next()}
if(upcoming!=null&&countdown>0)TvButton(if(autoplay)"Cancel autoplay"else "Autoplay off"){autoplay=!autoplay;android.util.Log.i("KaleidoPlayback","AUTOPLAY ${if(autoplay)"enabled"else "cancelled"} item=${item.id}")}
TvButton("Back to video"){autoplay=false;dismiss()}
}
}
}
val path=upcoming?.let{it.still.ifBlank{it.thumb}.ifBlank{it.art}} ?: item.art.ifBlank{item.thumb}
Box(modifier.fillMaxSize().background(Ink)) {
Box(Modifier.align(Alignment.TopEnd).width(640.dp).aspectRatio(16f/9f)) {
if(path.isNotBlank())Artwork(vm.api,path,Modifier.fillMaxSize(),960,540,animate=false)
Box(Modifier.fillMaxSize().background(Brush.horizontalGradient(0f to Ink,.42f to Ink.copy(alpha=.72f),1f to Color.Transparent)))
Box(Modifier.fillMaxSize().background(Brush.verticalGradient(.35f to Color.Transparent,1f to Ink)))
}
if(season.isNotEmpty())item {PostPlayRail(vm,"Episodes in this season",season){autoplay=false;vm.play(it,true)}}
if(vm.relatedShows.isNotEmpty())item {PostPlayRail(vm,"Related shows",vm.relatedShows){autoplay=false;vm.stopPlayback();vm.open(it)}}
Box(Modifier.offset(UpNextFrame.x,UpNextFrame.y).size(UpNextFrame.width,UpNextFrame.height).background(Color.Black))
}
}
@Composable private fun PostPlayRail(vm:KaleidoViewModel,label:String,titles:List<Title>,choose:(Title)->Unit) {
/**
* Up Next, over the shrunken player: the next episode with one countdown, the season and related shows.
* Any remote press stops the countdown. Left from Play next (or Back) returns to the playing video.
*/
@Composable internal fun PostPlayScreen(vm:KaleidoViewModel,item:Title,controller:PlaybackController,watchVideo:()->Unit,next:()->Unit) {
val upcoming=vm.followingEpisode(item)
// Settings › Playback sets the countdown; 0 turns autoplay off.
val countdown=if(vm.shuffling&&vm.autoplaySeconds==0)5 else vm.autoplaySeconds
var cancelled by remember{mutableStateOf(false)}
val counting=upcoming!=null&&countdown>0&&!cancelled
var elapsed by remember{mutableLongStateOf(0)}
// The countdown runs only while Kaleido is on screen; leaving it restarts on return.
val lifecycle by LocalLifecycleOwner.current.lifecycle.currentStateAsState()
val onScreen=lifecycle.isAtLeast(Lifecycle.State.STARTED)
LaunchedEffect(counting,upcoming?.id,onScreen) {
if(!counting||!onScreen||upcoming==null)return@LaunchedEffect
val total=countdown*1000L;elapsed=0
android.util.Log.i("KaleidoPlayback","AUTOPLAY countdown item=${item.id} next=${upcoming.id}")
while(elapsed<total){delay(50);elapsed+=50}
android.util.Log.i("KaleidoPlayback","AUTOPLAY starting next=${upcoming.id}");next()
}
val playFocus=remember{FocusRequester()}
val videoFocus=remember{FocusRequester()}
LaunchedEffect(Unit){withFrameNanos{};runCatching{(if(upcoming!=null)playFocus else videoFocus).requestFocus()}}
val season=vm.episodeQueue.filter{it.parentId==item.parentId}
Box(Modifier.fillMaxSize().onPreviewKeyEvent{
if(it.type==KeyEventType.KeyDown&&counting){cancelled=true;android.util.Log.i("KaleidoPlayback","AUTOPLAY cancelled item=${item.id}")}
false
}) {
// The video itself is the PlayerView beneath; this is its focus target and outline.
var videoFocused by remember{mutableStateOf(false)}
Box(Modifier.offset(UpNextFrame.x-4.dp,UpNextFrame.y-4.dp).size(UpNextFrame.width+8.dp,UpNextFrame.height+8.dp)
.focusRequester(videoFocus).focusProperties{right=if(upcoming!=null)playFocus else FocusRequester.Default}
.navigationSound().onFocusChanged{videoFocused=it.isFocused}
.border(if(videoFocused)2.dp else 1.dp,Color.White.copy(alpha=if(videoFocused)1f else .16f),RoundedCornerShape(8.dp))
.semantics{contentDescription="Return to "+item.displayTitle}.clickable(onClick=watchVideo))
NowPlaying(item,controller,videoFocused,Modifier.offset(UpNextFrame.x,UpNextFrame.y+UpNextFrame.height+10.dp).width(UpNextFrame.width))
Column(Modifier.padding(start=UpNextFrame.x+UpNextFrame.width+36.dp,top=36.dp,end=Cinema.gutter)) {
Eyebrow(if(upcoming==null)"More to watch"else if(vm.shuffling)"Up next · Shuffle"else "Up next")
Spacer(Modifier.height(8.dp))
// The playing episode carries its show's title art; listed episodes may not.
TitleIdentity(vm.api,item,Modifier.size(240.dp,44.dp))
if(upcoming!=null) {
val metadata by produceState(upcoming,upcoming.id){value=upcoming;value=vm.previewDetails(upcoming)}
Text(upcoming.title,color=Accent,fontSize=21.sp,lineHeight=26.sp,fontWeight=FontWeight.SemiBold,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.padding(top=6.dp))
Row(Modifier.padding(top=6.dp).height(17.dp),verticalAlignment=Alignment.CenterVertically) {
if(metadata.contentRating.isNotBlank())FormatBadge(metadata.contentRating,Modifier.padding(end=8.dp))
Text(listOf("S${upcoming.parentIndex} · E${upcoming.index}",if(upcoming.duration>0)runtimeLabel(upcoming.duration)else "").filter{it.isNotBlank()}.joinToString(" · "),color=Cinema.secondary,fontSize=11.sp,lineHeight=15.sp,maxLines=1)
AudienceRatings(metadata,Modifier.padding(start=10.dp))
}
if(metadata.summary.isNotBlank())Text(metadata.summary,color=Cinema.secondary,fontSize=12.sp,lineHeight=18.sp,maxLines=3,overflow=TextOverflow.Ellipsis,modifier=Modifier.padding(top=8.dp))
UpNextButton(if(vm.transitioningEpisode)"Loading…"else "Play next episode",if(counting)({(elapsed.toFloat()/(countdown*1000)).coerceIn(0f,1f)})else null,
Modifier.padding(top=14.dp).focusRequester(playFocus).focusProperties{left=videoFocus}.onFocusChanged{if(it.isFocused&&BuildConfig.DEBUG)android.util.Log.i("KaleidoPlayback","POSTPLAY focus=play")}) {
cancelled=true;next()
}
}
else Text("You've reached the end of this series.",color=Cinema.secondary,fontSize=12.sp,lineHeight=18.sp,modifier=Modifier.padding(top=8.dp))
}
LazyColumn(Modifier.fillMaxWidth().padding(top=292.dp),contentPadding=PaddingValues(start=Cinema.gutter,end=Cinema.gutter,bottom=24.dp),verticalArrangement=Arrangement.spacedBy(14.dp)) {
val up=if(upcoming!=null)playFocus else videoFocus
if(season.isNotEmpty())item {
val current=season.indexOfFirst{it.id==item.id}
PostPlayRail(vm,if(item.parentIndex>0)"Season ${item.parentIndex}"else "Episodes",season,up,(current-1).coerceAtLeast(0),{when(it.id){item.id->"Now playing";upcoming?.id->"Up next";else->if(it.duration>0)runtimeLabel(it.duration)else ""}}){vm.play(it,true)}
}
if(vm.relatedShows.isNotEmpty())item {PostPlayRail(vm,"Related shows",vm.relatedShows,if(season.isEmpty())up else null,0,{it.year}){vm.stopPlayback();vm.open(it)}}
}
}
}
/** Where the playing episode is, under the mini-player. Its own scope: position ticks recompose only this. */
@Composable private fun NowPlaying(item:Title,controller:PlaybackController,focused:Boolean,modifier:Modifier) {
Column(modifier) {
Row(verticalAlignment=Alignment.CenterVertically) {
Text((if(item.type=="episode")"S${item.parentIndex} · E${item.index} "else "")+item.title,color=if(focused)Accent else Cinema.secondary,fontSize=11.sp,lineHeight=15.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f))
Text("−"+clockTime(controller.duration-controller.position),color=Cinema.quiet,fontSize=10.sp,lineHeight=14.sp,maxLines=1,modifier=Modifier.padding(start=10.dp))
}
val progress=if(controller.duration>0)(controller.position.toFloat()/controller.duration).coerceIn(0f,1f)else 0f
Box(Modifier.padding(top=6.dp).fillMaxWidth().height(3.dp).clip(RoundedCornerShape(2.dp)).background(Color.White.copy(alpha=.22f))) {
Box(Modifier.fillMaxHeight().fillMaxWidth(progress).background(Accent))
}
}
}
/** Play next episode. While autoplay counts down ([progress] non-null) a lighter fill sweeps across it, without numbers. */
@Composable private fun UpNextButton(label:String,progress:(()->Float)?,modifier:Modifier,onClick:()->Unit) {
var focused by remember{mutableStateOf(false)}
val shape=RoundedCornerShape(5.dp)
val foreground=if(focused)Ink else Accent
Row(modifier.height(34.dp).navigationSound().onFocusChanged{focused=it.isFocused}.clip(shape)
.drawBehind{
val fill=progress?.invoke()
drawRect(if(focused)(if(fill!=null)Color(0xFFBDBDBD)else Accent)else Color.White.copy(alpha=.16f))
if(fill!=null)drawRect(if(focused)Accent else Color.White.copy(alpha=.18f),size=androidx.compose.ui.geometry.Size(size.width*fill,size.height))
}
.semantics{contentDescription=label}.clickable(onClick=onClick).padding(horizontal=14.dp),verticalAlignment=Alignment.CenterVertically,horizontalArrangement=Arrangement.spacedBy(7.dp)) {
Icon(Icons.Filled.PlayArrow,null,tint=foreground,modifier=Modifier.size(17.dp))
Text(label,color=foreground,fontSize=12.sp,lineHeight=16.sp,fontWeight=FontWeight.SemiBold)
}
}
@Composable private fun PostPlayRail(vm:KaleidoViewModel,label:String,titles:List<Title>,up:FocusRequester?,start:Int,caption:(Title)->String,choose:(Title)->Unit) {
Column {
Text(label,color=Accent,fontSize=16.sp,fontWeight=FontWeight.SemiBold,modifier=Modifier.padding(bottom=8.dp))
LazyRow(horizontalArrangement=Arrangement.spacedBy(12.dp)) {
Text(label,color=Accent,fontSize=16.sp,lineHeight=21.sp,fontWeight=FontWeight.SemiBold,modifier=Modifier.padding(bottom=8.dp))
LazyRow(state=rememberLazyListState(start),horizontalArrangement=Arrangement.spacedBy(12.dp)) {
items(titles,key={it.id}){title->
var focused by remember{mutableStateOf(false)}
Column(Modifier.width(167.dp).navigationSound().onFocusChanged{focused=it.isFocused}.semantics{contentDescription=title.displayTitle+" "+title.subtitle}.clickable{choose(title)}) {
Box(Modifier.fillMaxWidth().aspectRatio(16f/9f).clip(RoundedCornerShape(4.dp))) {
Column(Modifier.width(188.dp).then(if(up!=null)Modifier.focusProperties{this.up=up}else Modifier).navigationSound().onFocusChanged{focused=it.isFocused}.semantics{contentDescription=title.displayTitle+" "+title.subtitle}.clickable{choose(title)}) {
Box(Modifier.fillMaxWidth().aspectRatio(16f/9f).clip(RoundedCornerShape(6.dp))) {
Artwork(vm.api,if(title.type=="episode")title.still.ifBlank{title.thumb}else title.art.ifBlank{title.thumb},Modifier.fillMaxSize(),384,216,animate=false)
if(focused)Box(Modifier.fillMaxSize().border(2.dp,Accent,RoundedCornerShape(4.dp)))
if(focused)Box(Modifier.fillMaxSize().border(2.dp,Accent,RoundedCornerShape(6.dp)))
}
Text(if(title.type=="episode")"${title.index}. ${title.title}"else title.title,color=if(focused)Accent else Cinema.secondary,fontSize=10.sp,lineHeight=14.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.padding(top=4.dp))
Text(if(title.type=="episode")"${title.index}. ${title.title}"else title.title,color=if(focused)Accent else Cinema.secondary,fontSize=11.sp,lineHeight=15.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.padding(top=5.dp))
Text(caption(title),color=Cinema.quiet,fontSize=10.sp,lineHeight=14.sp,maxLines=1)
}
}
}

View file

@ -35,6 +35,7 @@ import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.layout
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.input.key.*
import androidx.compose.ui.platform.LocalDensity
@ -99,7 +100,8 @@ import kotlinx.coroutines.delay
// Derived: the player only recomposes when a marker starts or ends, not on every position tick.
val marker by remember{derivedStateOf{item.markers.firstOrNull{controller.position>=it.start&&controller.position<it.end&&it.type in listOf("intro","credits")}}}
fun skip(marker:Marker){
if(marker.type=="credits"&&item.type=="episode"){controller.pause();android.util.Log.i("KaleidoPlayback","POSTPLAY item=${item.id} reason=skip-credits");postPlay=true}
// Episodes go to Up Next, where the credits keep playing in the corner.
if(marker.type=="credits"&&item.type=="episode"){android.util.Log.i("KaleidoPlayback","POSTPLAY item=${item.id} reason=skip-credits");postPlay=true}
else controller.seekTo(marker.end)
}
// Each marker counts down to an automatic skip once, so seeking back into it plays it.
@ -114,6 +116,8 @@ import kotlinx.coroutines.delay
if(m==null||controller.loading||postPlay||m in autoSkipped){if(m==null||postPlay)autoSkip=null;return@LaunchedEffect}
val seconds=when(m.type){"intro"->vm.autoSkipIntroSeconds;"credits"->vm.autoSkipCreditsSeconds;else->0}
if(seconds<=0)return@LaunchedEffect
// Up Next has the one countdown (to the next episode), so automatic credits open it at once.
if(m.type=="credits"&&item.type=="episode"){autoSkipped+=m;android.util.Log.i("KaleidoPlayback","POSTPLAY item=${item.id} reason=credits");postPlay=true;return@LaunchedEffect}
if(autoSkip!=m){autoSkip=m;autoSkipTotal=seconds*1000L;autoSkipRemaining=autoSkipTotal;android.util.Log.i("KaleidoPlayback","AUTOSKIP countdown ${m.type} seconds=$seconds item=${item.id}")}
while(autoSkipRemaining>0){delay(50);if(autoSkip!=m)return@LaunchedEffect;if(controller.isPlaying)autoSkipRemaining-=50}
if(autoSkip!=m)return@LaunchedEffect
@ -127,13 +131,20 @@ import kotlinx.coroutines.delay
if(!owner.lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED))controller.enterBackground()
onDispose{owner.lifecycle.removeObserver(observer);activity.window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);controller.close()}
}
LaunchedEffect(controls,interaction,controller.isPlaying,trackMenu) {
if(controls&&controller.isPlaying&&trackMenu==0){delay(5000);controls=false}
// Up Next owns focus while open: hiding the controls behind it must not take focus back.
LaunchedEffect(controls,interaction,controller.isPlaying,trackMenu,postPlay) {
if(controls&&controller.isPlaying&&trackMenu==0&&!postPlay){delay(5000);controls=false}
}
LaunchedEffect(controls) {if(!controls){timelineReveal=false;delay(210);runCatching{rootFocus.requestFocus()}}}
LaunchedEffect(controls) {if(!controls&&!postPlay){timelineReveal=false;delay(210);if(!postPlay)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()}
// Leaving Up Next returns to the full-screen video without revealing the controls.
var refocusRoot by remember{mutableIntStateOf(0)}
LaunchedEffect(refocusRoot){if(refocusRoot>0){withFrameNanos{};runCatching{rootFocus.requestFocus()}}}
fun leaveUpNext(){postPlay=false;controls=false;refocusRoot++;android.util.Log.i("KaleidoPlayback","POSTPLAY closed item=${item.id}")}
// The video shrinks into Up Next's corner and grows back; only its layout reads the animation.
val upNext=androidx.compose.animation.core.animateFloatAsState(if(postPlay)1f else 0f,tween(320),label="upNext")
fun goBack(){if(postPlay)leaveUpNext() else if(trackMenu!=0)closeTracks()else if(controls)controls=false else vm.stopPlayback()}
BackHandler(onBack=::goBack)
val visible=controls&&!postPlay
Box(Modifier.fillMaxSize().background(Color.Black).focusRequester(rootFocus).onPreviewKeyEvent{event->
@ -170,6 +181,7 @@ import kotlinx.coroutines.delay
}
}
}.focusable()) {
if(postPlay)UpNextBackdrop(vm,item,Modifier.graphicsLayer{alpha=upNext.value})
AndroidView(factory={context->PlayerView(context).apply {
setEnableComposeSurfaceSyncWorkaround(true)
player=controller.player
@ -178,8 +190,14 @@ import kotlinx.coroutines.delay
descendantFocusability=ViewGroup.FOCUS_BLOCK_DESCENDANTS
setShowBuffering(PlayerView.SHOW_BUFFERING_NEVER)
setKeepContentOnPlayerReset(true)
}},update={view->view.subtitleView?.let{applySubtitleStyle(it,vm.subtitleSize,vm.subtitleStyle)}},modifier=Modifier.fillMaxSize(),onRelease={it.player=null})
if(controller.loading)CircularProgressIndicator(color=Accent,strokeWidth=2.dp,modifier=Modifier.align(Alignment.Center).size(30.dp))
}},update={view->view.subtitleView?.let{applySubtitleStyle(it,vm.subtitleSize,vm.subtitleStyle)}},modifier=Modifier.fillMaxSize().layout{measurable,constraints->
val f=upNext.value
fun lerp(a:Int,b:Int)=(a+(b-a)*f).toInt()
val width=lerp(constraints.maxWidth,UpNextFrame.width.roundToPx());val height=lerp(constraints.maxHeight,UpNextFrame.height.roundToPx())
val placeable=measurable.measure(androidx.compose.ui.unit.Constraints.fixed(width,height))
layout(constraints.maxWidth,constraints.maxHeight){placeable.place(lerp(0,UpNextFrame.x.roundToPx()),lerp(0,UpNextFrame.y.roundToPx()))}
},onRelease={it.player=null})
if(controller.loading&&!postPlay)CircularProgressIndicator(color=Accent,strokeWidth=2.dp,modifier=Modifier.align(Alignment.Center).size(30.dp))
QuickSkipFeedback(skipSeconds,skipPulse,!visible&&!postPlay,Modifier.align(if(skipForward)Alignment.CenterEnd else Alignment.CenterStart).padding(horizontal=32.dp))
AnimatedVisibility(visible=visible,enter=fadeIn(tween(190))+slideInVertically(tween(190)){it/8},exit=fadeOut(tween(190))+slideOutVertically(tween(190)){it/10},modifier=Modifier.align(Alignment.BottomCenter)) {
Column(Modifier.fillMaxWidth().background(Brush.verticalGradient(0f to Color.Transparent,.35f to Color.Black.copy(alpha=.5f),1f to Color.Black.copy(alpha=.85f))).padding(start=Cinema.gutter,end=Cinema.gutter,top=48.dp,bottom=16.dp)) {
@ -233,7 +251,7 @@ import kotlinx.coroutines.delay
val counting=autoSkip==marker&&autoSkipTotal>0
SkipMarkerButton(marker.type=="intro",if(counting)1f-(autoSkipRemaining.toFloat()/autoSkipTotal).coerceIn(0f,1f)else null){autoSkip=null;autoSkipped+=marker;skip(marker);interacted()}
}}
if(postPlay)PostPlayScreen(vm,item,{postPlay=false;controls=true},{vm.nextEpisode(item)})
if(postPlay)PostPlayScreen(vm,item,controller,::leaveUpNext){vm.nextEpisode(item)}
controller.error?.let{ErrorDialog(it,{vm.stopPlayback()},{controller.retry()})}
if(trackMenu==1)AudioTrackPanel(controller,::closeTracks,::closeTracks)
if(trackMenu==2) {

View file

@ -236,7 +236,7 @@ fun CohesiveSettingsScreen(vm: KaleidoViewModel, install: (File) -> Unit) {
)
SettingsValueRow(
title = "Autoplay next episode",
description = "Count down to the next episode when one ends.",
description = "Up Next counts down to the next episode. Any remote press stops it.",
value = autoplayLabel(vm.autoplaySeconds),
requester = autoplayFocus,
leftTarget = categoryFocus[1],
@ -252,7 +252,7 @@ fun CohesiveSettingsScreen(vm: KaleidoViewModel, install: (File) -> Unit) {
)
SettingsValueRow(
title = "Skip credits",
description = "Episodes go straight to Up Next; movies skip past the credits. Any remote press cancels an automatic skip.",
description = "Automatic: episodes open Up Next as the credits start; movies skip past them after the delay.",
value = autoSkipLabel(vm.autoSkipCreditsSeconds),
requester = creditsFocus,
leftTarget = categoryFocus[1],

View file

@ -233,6 +233,7 @@ internal fun nextUp(episodes:List<Title>,watchedPercent:Int)=episodes.firstOrNul
@Composable private fun CastRail(vm:KaleidoViewModel,item:Title,actionFocus:FocusRequester,entry:FocusRequester) {
val initial=remember(item.id){item.castMembers.indexOfFirst{"cast:${item.id}:${it.id.ifBlank{it.name}}"==vm.focusId}.coerceAtLeast(0)}
val row=rememberLazyListState(initialFirstVisibleItemIndex=initial)
val entryIndex by rememberRowEntry(row,0)
Column {
Text("Cast",color=Accent,fontSize=17.sp,fontWeight=FontWeight.SemiBold,modifier=Modifier.padding(start=Cinema.gutter,bottom=10.dp))
LazyRow(state=row,contentPadding=PaddingValues(horizontal=Cinema.gutter),horizontalArrangement=Arrangement.spacedBy(16.dp),modifier=Modifier.focusRestorer(fallback=entry)) {
@ -241,7 +242,7 @@ internal fun nextUp(episodes:List<Title>,watchedPercent:Int)=episodes.firstOrNul
var focused by remember{mutableStateOf(false)}
val requester=remember{FocusRequester()}
LaunchedEffect(Unit){if(vm.focusId==key){withFrameNanos{};runCatching{requester.requestFocus()}}}
Column(Modifier.width(108.dp).then(if(index==0)Modifier.focusRequester(entry)else Modifier).focusRequester(requester).focusProperties{if(item.type!="collection"&&vm.children.isEmpty())up=actionFocus}.navigationSound().onFocusChanged{
Column(Modifier.width(108.dp).then(if(index==entryIndex)Modifier.focusRequester(entry)else Modifier).focusRequester(requester).focusProperties{if(item.type!="collection"&&vm.children.isEmpty())up=actionFocus}.navigationSound().onFocusChanged{
focused=it.isFocused;if(it.isFocused)vm.focusId=key
}.clickable(enabled=actor.id.isNotBlank()){vm.openActor(actor)}.clearAndSetSemantics{
contentDescription=listOf(actor.name,actor.role).filter{it.isNotBlank()}.joinToString(". ")

View file

@ -0,0 +1,32 @@
package tv.kaleido.app
import androidx.compose.foundation.lazy.LazyListItemInfo
import org.junit.Assert.assertEquals
import org.junit.Test
class RowEntryTest {
private fun card(index:Int,offset:Int)=object:LazyListItemInfo {
override val index=index
override val key:Any=index
override val offset=offset
override val size=264
}
// A 264 px card plus 24 px spacing; the row's start padding is 88 px (viewportStart -88).
private fun row(first:Int,firstOffset:Int,count:Int)=List(count){card(first+it,firstOffset+it*288)}
@Test fun keepsThePreferredCardWhileItIsInView() {
assertEquals(0,rowEntryIndex(0,row(0,0,7),-88))
assertEquals(3,rowEntryIndex(3,row(1,-100,7),-88))
}
@Test fun scrolledAwayRowEntersAtTheFirstFullyVisibleCard() {
// Seasons row restored to its end: Season 6 (index 5) is clipped, Season 7 is the first whole card.
assertEquals(6,rowEntryIndex(0,row(5,-167,7),-88))
// A card resting in the start padding is still wholly on screen.
assertEquals(4,rowEntryIndex(0,row(4,-60,7),-88))
}
@Test fun emptyLayoutKeepsThePreferredCard() {
assertEquals(2,rowEntryIndex(2,emptyList(),-88))
}
}

Binary file not shown.

View file

@ -1 +1 @@
2d4fada001103d337515a05bec9a6edae01a33744fd4e36049a4fce149e11be6 Kaleido.apk
2fd832eb90633d1519c15abccc122970a3c5ef51933da35634b8a5b1429d5bc3 Kaleido.apk

View file

@ -1,7 +1,7 @@
{
"version": "0.7.0",
"versionCode": 23,
"url": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.7.0/distribution/Kaleido.apk",
"checksumUrl": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.7.0/distribution/Kaleido.apk.sha256",
"notes": "- Add a Previous episode button to the player, and redesign its controls: elapsed and remaining time at the ends of the timeline, previous episode, back 10 seconds, play, forward 30 seconds and next episode grouped in the centre, and the finish time beside Exit. Previous episode also steps back through a shuffle.\n- Skip intros and credits automatically after a delay you choose in Settings \u203a Playback (3, 5, 10 or 15 seconds, or show the button only). A pending skip reads \"Skipping intro\" with a filling background; pressing any button on the remote cancels it, and OK skips straight away. The earlier \"Automatically\" setting becomes a 5-second skip.\n- Show what you watch on other devices promptly: Kaleido checks Continue Watching every 15 seconds while open and as soon as you return to it.\n- Keep playback paused when you leave Kaleido while a stream is still starting, and only count down to the next episode while Kaleido is on screen.\n- Keep the resume point when leaving a title before its stream has started, and keep progress reports on the server the title came from.\n- Close Settings \u203a Choose server with Back or the new Cancel button, and enter Home's rows from the Home tab when there is no featured title.\n- Cancel slow network requests when they are no longer needed, and connect to the best server address as soon as it answers.\n- Update a title's format badges when you pick another version, keep New Seasons when one show can't be loaded, and keep focus on Continue Watching when a card is replaced while a title page is open.\n- Remove Volume boost, which degraded audio, and leave the player with the server's reason when a stream is stopped from the Plex dashboard."
"version": "0.8.1",
"versionCode": 25,
"url": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.8.1/distribution/Kaleido.apk",
"checksumUrl": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.8.1/distribution/Kaleido.apk.sha256",
"notes": "- Fix a title page where Down from the buttons did nothing, leaving you stuck at the top. This happened when the Seasons, Cast or another row below had been scrolled away from its first card, for example by reopening a show from Continue Watching. Down now moves to a card in view."
}

View file

@ -5,7 +5,7 @@ The interface gives artwork priority. App chrome uses neutral near-black, charco
## Layout and typography
- Horizontal safe gutter: 44 dp. Navigation: 62 dp, with centered text destinations and independent search/settings icons.
- Home retains a large cinematic feature: an 80 percent stage with original title artwork, synopsis, playback and information actions, with Continue Watching peeking below. Entering the rows compacts it into a Silo-style preview of the focused card instead of scrolling it away: the hero lifts and fades as the rows slide up beneath a bottom-anchored block (64 dp title art, content-rating badge, year/episode, genre, runtime or time left, ratings, three synopsis lines, three cast names and 4K/HDR/Atmos format badges). The card's own image (an episode's still, not its show's art) is scaled whole into a top-right box of 72 × 78 percent of the screen, baked off-thread to fade into the page toward its left and bottom edges. Movies and TV use the same preview (56 dp title art) beneath their Discover/Library/Categories line, with rows starting 300 dp down; their row content stays distinct. With Settings › Interface › Artwork colour wash (default On), the page beneath carries the artwork's average colour normalized to 0.22 luminance, diagonally from the top-right (full) to the bottom-left (18 percent), as Silo does. It is baked into the same cached 960 × 540 frame, so it costs nothing per frame and changes through the artwork crossfade. A 1280 × 720 frame was tried for sharper art and raised Movies' horizontal p95 from about 31 to 36 ms through larger texture uploads, so it was not kept. The preview stays composed, invisible, under the hero with the first row's first card, so entering the rows is only a fade. Up from the first row or Back restores the hero. Features interleave recently released, highly rated unwatched, and Plex-suggested movies/shows, excluding Continue Watching. They shuffle per refresh and rotate every 12 seconds while the hero is active, pausing during row browsing.
- Home retains a large cinematic feature: an 80 percent stage with original title artwork, synopsis, playback and information actions, with Continue Watching peeking below. Entering the rows compacts it into a Silo-style preview of the focused card instead of scrolling it away: the hero lifts and fades as the rows slide up beneath a bottom-anchored block (64 dp title art, content-rating badge, year/episode, genre, runtime or time left, ratings, three synopsis lines, three cast names and 4K/HDR/Atmos format badges). The card's own image (an episode's still, not its show's art) is scaled whole into a top-right box of 72 × 78 percent of the screen, baked off-thread to fade into the page toward its left and bottom edges. Movies and TV use the same preview (56 dp title art) beneath their Discover/Library/Categories line, with rows starting 300 dp down; their row content stays distinct. With Settings › Interface › Artwork colour wash (default On), the page beneath carries the artwork's average colour normalized to 0.22 luminance, diagonally from the top-right (full) to the bottom-left (18 percent), as Silo does. It is baked into the same cached 960 × 540 frame, so it costs nothing per frame and changes through the artwork crossfade. A 1280 × 720 frame was tried for sharper art and raised Movies' horizontal p95 from about 31 to 36 ms through larger texture uploads, so it was not kept. The preview stays composed, invisible, under the hero with the first row's first card, so entering the rows is only a fade. Up from the first row or Back restores the hero. Features interleave recently released, highly rated unwatched, and Plex-suggested movies/shows, excluding Continue Watching, without a label naming the source. They shuffle per refresh and rotate every 12 seconds while the hero is active, pausing during row browsing.
- Movies uses a compact fixed preview above poster rows, with the backdrop and synopsis following focused titles. Recently released films and movie recommendations lead. TV uses a shorter preview, larger episode thumbnails, next episodes, newly added seasons, and then new episodes and show recommendations. Redundant TV hubs are omitted when their episode lists match exactly. These are deliberately different compositions.
- Library: title and discovery/full-library navigation share a 64 dp header. A 43 dp filter row sits immediately above the six-column poster grid.
- Browsing card widths: landscape 214 dp, TV episodes 264 dp, posters 120 dp. Landscape artwork uses 16:9; posters use 2:3. The full grid scales six columns to available width. Captions reserve a fixed height.
@ -41,7 +41,7 @@ Controls occupy a bottom gradient. The title uses the same original title art (2
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.
Credits (automatically, or through Skip credits) and episode endings open Up Next: the playing video shrinks to a 352 × 198 dp frame at the top left and keeps playing, beside the next episode's still (top right, fading into the page), title art, episode title, facts line and three-line synopsis, with the season and related shows below. The page is drawn beneath the PlayerView so its SurfaceView shows through. Play next episode carries the only countdown (Settings › Autoplay next episode) as a sweeping fill; any remote press stops it. Left from Play next focuses the video; selecting it, or Back, returns to the full-screen credits. Each player session has a unique Media3 session ID so overlapping Compose disposal and next-episode creation cannot collide.
Settings includes a persistent watched percentage. Timeline reporting scrobbles the item in Plex once the selected percentage is reached, retries a failed write, and avoids repeated scrobbles within the same player session. This preference belongs to Kaleido and does not change the Plex server's global settings. Explicit watched changes refresh the title and parent episode counts across browsing caches.

View file

@ -22,7 +22,7 @@ Open Kaleido and enter its code at [plex.tv/link](https://plex.tv/link). Setting
D-pad moves focus, OK activates, and Back returns through details and seasons. In the player, OK shows controls; Left/Right while controls are hidden seeks; dedicated media keys control playback. The on-screen controls provide pause, seeking, audio, subtitles, next episode, and exit. Back first hides controls, then exits playback. Stopping or leaving the app reports the latest position to Plex.
Original quality is the default, requesting the source video and remuxing where supported, with a 1080p conversion fallback. The player gear exposes the same quality preference as Settings, along with audio, subtitles, speed and chapters. Media3's SurfaceView preserves supported HDR. Actual HDR, Dolby Vision, codecs, and audio passthrough depend on the device, connected display/receiver, source profile, and server. Plex owns transcoding capability and any account entitlements. Unsupported subtitle formats use server conversion. Intro and credit buttons appear when the server supplies markers. Scrubbing displays server-generated video previews or chapter thumbnails when available; the timeline also shows buffered progress. Episode endings and Skip credits show a cancellable five-second next-episode countdown, season episodes, and related shows.
Original quality is the default, requesting the source video and remuxing where supported, with a 1080p conversion fallback. The player gear exposes the same quality preference as Settings, along with audio, subtitles, speed and chapters. Media3's SurfaceView preserves supported HDR. Actual HDR, Dolby Vision, codecs, and audio passthrough depend on the device, connected display/receiver, source profile, and server. Plex owns transcoding capability and any account entitlements. Unsupported subtitle formats use server conversion. Intro and credit buttons appear when the server supplies markers. Scrubbing displays server-generated video previews or chapter thumbnails when available; the timeline also shows buffered progress. Credits and episode endings open Up Next: the video keeps playing in a corner beside the next episode, its single countdown, the season and related shows.
## Updates and releases

View file

@ -105,24 +105,28 @@ def credits():
marker=next(m for m in item['Marker'] if m['type']=='credits')
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',str(marker['startTimeOffset']+2000),'--ei','testMode','2','--ez','testValidation','true')
await_ready(7599);key(127);focused('Play');key(19);focused('Playback timeline');key(19);focused('Skip credits')
screenshot('skip-credits-contrast');key(23)
deadline=time.monotonic()+8
while time.monotonic()<deadline:
time.sleep(.1)
ready=adb('logcat','-d','-s','KaleidoPlayback:I','*:S').decode(errors='replace')
if 'POSTPLAY focus=play' in ready:break
assert 'POSTPLAY focus=play' in ready,'Postplay initial action never received focus'
key(22);key(23)
wait(lambda r:'Autoplay off' in labels(r),'Autoplay cancellation')
screenshot('postplay-season-and-related');time.sleep(6)
root=snapshot();assert 'Up next' in labels(root),'Cancellation failed to keep postplay open'
assert 'Episodes in this season' in labels(root),'Season episodes absent'
assert 'Related shows' in labels(root),'Related shows absent'
logs=adb('logcat','-d','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
assert 'reason=skip-credits' in logs,'Skip credits did not open postplay'
assert 'AUTOPLAY starting' not in logs,'Cancelled autoplay still advanced'
(OUT/'postplay-cancel.log').write_text(logs)
print('PASS skip credits -> postplay, episode/related rows, cancellable autoplay')
await_ready(7599)
def log():return adb('logcat','-d','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
# Automatic credits open Up Next at once; with "Show button" the Skip credits button opens it.
deadline=time.monotonic()+4
while time.monotonic()<deadline and 'POSTPLAY focus=play' not in log():time.sleep(.2)
if 'POSTPLAY focus=play' not in log():
key(127);focused('Play');key(19);focused('Playback timeline');key(19);focused('Skip credits')
screenshot('skip-credits-contrast');key(23)
deadline=time.monotonic()+8
while time.monotonic()<deadline and 'POSTPLAY focus=play' not in log():time.sleep(.1)
assert 'POSTPLAY focus=play' in log(),'Up Next initial action never received focus'
screenshot('up-next')
key(20) # any press stops the countdown
time.sleep(6);root=snapshot();found=labels(root)
assert 'Up next' in found or 'UP NEXT' in found,'Cancellation failed to keep Up Next open'
assert any(l.startswith('Season ') for l in found),'Season episodes absent'
assert 'Related shows' in found,'Related shows absent'
logs=log()
assert 'AUTOPLAY cancelled' in logs and 'AUTOPLAY starting' not in logs,'Cancelled autoplay still advanced'
key(4);time.sleep(1)
assert 'POSTPLAY closed' in log(),'Back did not return to the video'
(OUT/'postplay-cancel.log').write_text(log())
print('PASS credits -> Up Next, episode/related rows, any press stops autoplay, Back returns to video')
if __name__=='__main__':globals()[sys.argv[1]]()

View file

@ -1,2 +1,2 @@
versionName=0.7.0
versionCode=23
versionName=0.8.1
versionCode=25