recloudstream / recloudstream/cloudstream

SubtitleResource: Subtitles from ZIP appear empty in player despite correct file content

Open
#3,009 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api bug
Dominant language
Kotlin
Stars
10.7k
Forks
1.1k
Avg merge
1d 23h
Merged PRs (30d)
15

Description

Steps to reproduce

I am downloading a ZIP file, extracting the .srt files into a temporary file using File.createTempFile, and adding them to the player using SubtitleResource().addFile().

Although I can verify that the downloaded .srt files are perfectly formatted and contain correct data (I have checked the files in the cache directory), the player fails to display any subtitles. The PlayerView shows SubtitlesUpdatedEvent but no tracks are loaded or the subtitle content appears empty.

To Reproduce

  1. Fetch a ZIP archive containing .srt files.
    
  2. Use SubtitleResource().addFile(tempFile, entry.name) to add the subtitle.
    
  3. Pass the URL from subResource.getSubtitles() to the subtitleCallback.
    
  4. Play the media.
    
val zipStream = ZipInputStream(zipBytes.inputStream())
var entry = zipStream.nextEntry

while (entry != null) {
    if (!entry.isDirectory && entry.name.lowercase().endsWith(".srt")) {
        val tempFile = File.createTempFile("sub", ".srt")
        tempFile.writeBytes(zipStream.readBytes())
        subResource.addFile(tempFile, entry.name)
    }
    entry = zipStream.nextEntry
}
zipStream.close()

subResource.getSubtitles().forEach { res ->
    subtitleCallback(
        newSubtitleFile(
            lang = "Turkish",
            url = res.url,
        )
    )
}

What am i doing wrong.

Expected behavior

The subtitles should be parsed and displayed correctly by the player.

Actual behavior

The subtitles not displayed

Cloudstream version and commit hash

4.7.0-PRE 2cde74d 3 Temmuz 2026 18:48:20

Android version

Android 16

Logcat
07-07 01:02:46.681 29581 29581 I CS3ExoPlayer: setPreferredSubtitles init SubtitleData(originalName=Turkish, nameSuffix=12, url=file:///data/user/0/com.lagradost.cloudstream3.prerelease/cache/sub7352673553558980328.srt, origin=URL, mimeType=application/x-subrip, headers={}, languageCode=tr)
07-07 01:02:46.681 29581 29581 I CS3ExoPlayer: setPreferredSubtitles IS_ACTIVE
07-07 01:02:46.720 29581 29581 I PlayerView: Handle event: EmbeddedSubtitlesFetchedEvent(tracks=[], source=Player)
07-07 01:02:46.725 29581 29581 I PlayerView: Handle event: SubtitlesUpdatedEvent(source=Player)
Other details

The .srt files are valid and readable when opened manually.

is local files are not supported what am i doing wrong?

Acknowledgements
  • I am sure my issue is related to the app and NOT some extension.
  • I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open issue.
  • I have written a short but informative title.
  • I have updated the app to pre-release version Latest.
  • I will fill out all of the requested information in this form.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the local file URL from SubtitleResource().addFile() through getSubtitles() and the subtitleCallback into PlayerView. Use the provided log showing EmbeddedSubtitlesFetchedEvent(tracks=[]) to compare the extracted SRT path and MIME handling with the player's subtitle loading path. Done means a valid extracted SRT produces a loaded track and visible subtitles.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
audio-video-rtc, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.