jellyfin / jellyfin-android

Android Client for Jellyfin

Home Page:https://jellyfin.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SAMI External subtitle does not show on Exoplayer and External Player

gkswngh05 opened this issue · comments

Describe the bug

The subtitle does not show on Exoplayer and External Player when external subtitle format is SAMI(*.smi, *.sami).

if (mediaStream.deliveryMethod == SubtitleDeliveryMethod.EXTERNAL) {
val deliveryUrl = mediaStream.deliveryUrl
val mimeType = CodecHelpers.getSubtitleMimeType(mediaStream.codec)
if (deliveryUrl != null && mimeType != null) {

When subtitle format is SAMI, mediaStream.codec returns "sami".
But "sami" is not defined in CodecHelpers.getSubtitleMimeType, so that function returns null.

fun getSubtitleMimeType(codec: String?): String? {
return when (codec) {
"srt", "subrip" -> MimeTypes.APPLICATION_SUBRIP
"ssa", "ass" -> MimeTypes.TEXT_SSA
"ttml" -> MimeTypes.APPLICATION_TTML
"vtt", "webvtt" -> MimeTypes.TEXT_VTT
"idx", "sub" -> MimeTypes.APPLICATION_VOBSUB
"pgs", "pgssub" -> MimeTypes.APPLICATION_PGS
"smi", "smil" -> "application/smil+xml"
else -> null
}
}

Since Jellyfin server is converting SAMI subtitle to Subrip format before sending to client, a quick and dirty solution would be defining "sami" as MimeTypes.APPLICATION_SUBRIP.

 fun getSubtitleMimeType(codec: String?): String? { 
     return when (codec) { 
         "srt", "subrip" -> MimeTypes.APPLICATION_SUBRIP 
         "ssa", "ass" -> MimeTypes.TEXT_SSA 
         "ttml" -> MimeTypes.APPLICATION_TTML 
         "vtt", "webvtt" -> MimeTypes.TEXT_VTT 
         "idx", "sub" -> MimeTypes.APPLICATION_VOBSUB 
         "pgs", "pgssub" -> MimeTypes.APPLICATION_PGS 
         "smi", "smil" -> "application/smil+xml"
         "sami" -> MimeTypes.APPLICATION_SUBRIP
         else -> null 
     } 
 } 

Logs

No response

Application version

2.6.1

Where did you install the app from?

Google Play

Device information

Galaxy S23 Ultra

Android version

Android 14, One UI 6.1

Jellyfin server version

10.9.0

Which video player implementations does this bug apply to?

  • Web player (default)
  • Integrated player (ExoPlayer)
  • External player (VLC, mpv, MX Player)

Come to think about it, I think it might be the Jellyfin server's problem. I may have to investigate about it...
Edit: Nevermind.