Skip to content

Select external subtitles to make them appear in engine.$subtitleTracks. #88

Closed

Description

@ijuniorfu

What should the engine do?

Select external subtitles to make them appear in engine.$subtitleTracks.

Motivating media or use case

No response

Area

Other

Host app / integration context

No response

Would you be willing to open a PR?

No

Activity

  1. added
    enhancement
    on Jun 29, 2026
  2. superuser404notfound commented on Jul 2, 2026

    @superuser404notfound
    Owner

    This is on main now (dd13c96) and will be part of the next release. External subtitle files register as first-class tracks:

    // Any time after load: appears in engine.$subtitleTracks with a synthetic id and isExternal == true.
    let track = engine.addExternalSubtitleTrack(
        ExternalSubtitleTrack(url: srtURL, name: "English", language: "en"))
    engine.selectSubtitleTrack(index: track.id)   // same call as embedded tracks
    
    // Declared at load instead, external tracks also join the native WebVTT renditions
    // (subtitles in PiP / AirPlay), and preferredSubtitleLanguages ranks them:
    LoadOptions(prepareNativeSubtitles: true,
                externalSubtitles: [ExternalSubtitleTrack(url: srtURL, language: "en")])

    Details: selectSubtitleTrack/selectSecondarySubtitleTrack accept the synthetic ids and publish them via activeSubtitleTrackIndex; removeExternalSubtitleTrack(id:) unregisters; the descriptor carries name, language, forced/SDH flags, per-track HTTP headers, and a format hint. Tracks added after load are host-overlay only until the next load, because the rendition set is fixed in the master playlist at item creation. Full docs in the README quick start and docs/formats.md.

    Leaving this open until you can confirm it covers your use case. If you can give it a try from main and report back, that would be much appreciated.

  3. superuser404notfound commented on Jul 2, 2026

    @superuser404notfound
    Owner

    This is now shipped in 4.10.0, so you can pin a release tag instead of a main commit for testing. API surface is unchanged from the comment above: LoadOptions.externalSubtitles, addExternalSubtitleTrack, removeExternalSubtitleTrack, TrackInfo.isExternal.

  4. ijuniorfu commented on Jul 4, 2026

    @ijuniorfu
    Author

    Thank you very much; the test went smoothly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions