Skip to content

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

Description

@Kraptor123

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiNeeds updated mainapibugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions