mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-07 20:38:43 +02:00
Make AudioTrack.mimeType nullable to prevent Android playback stall
The POST /api/items/<id>/play/<episodeId> response inlines every episode of a podcast with an audioTrack per episode. Server-side, audioTrack.mimeType is derived from audioFile.mimeType, which is null when the row was created without a successful audio probe (direct DB inserts, import scripts, partial probe failures). The Jackson deserializer hits one null mimeType among the inlined episodes, throws MissingKotlinParameterException, and the entire play-session response fails to deserialize. ExoPlayer is never called, the UI silently stalls. Make mimeType nullable on the data class to tolerate this. ExoPlayer's MediaItem.Builder.setMimeType already accepts nullable. Defensively coerce null to empty string for Cast's MediaInfo.Builder.setContentType, whose Java signature is non-null. Fixes #1905
This commit is contained in:
@@ -10,7 +10,7 @@ data class AudioTrack(
|
||||
var duration: Double,
|
||||
var title: String,
|
||||
var contentUrl: String,
|
||||
var mimeType: String,
|
||||
var mimeType: String?,
|
||||
var metadata: FileMetadata?,
|
||||
var isLocal: Boolean,
|
||||
var localFileId: String?,
|
||||
|
||||
@@ -332,7 +332,7 @@ class PlaybackSession(
|
||||
MediaInfo.Builder(mediaUri.toString())
|
||||
.apply {
|
||||
setContentUrl(mediaUri.toString())
|
||||
setContentType(audioTrack.mimeType)
|
||||
setContentType(audioTrack.mimeType ?: "")
|
||||
setMetadata(castMetadata)
|
||||
setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user