debugly / ijkplayer

【持续更新】macOS/iOS video player based on ijkplayer, using FFmpeg 5.1, support Metal、hw accel、HDR、ass subtitle effect...
GNU General Public License v2.0
69 stars 14 forks source link

[Discussions] 问题探讨 #21

Closed hsuyelin closed 3 weeks ago

hsuyelin commented 1 month ago

请问有什么办法可以加载本地字幕么,在demo工程按照如下方式加载并不生效

NSString *subtitlePath = [[NSBundle mainBundle] pathForResource:@"chs" ofType:@"srt"];
[self.player loadSubtitleOnly:[NSURL fileURLWithPath:subtitlePath]];
debugly commented 1 month ago

使用 loadThenActiveSubtitle 方法,会立马激活。 使用 loadSubtitleOnly 或者 loadSubtitlesOnly 只是挂载,没有激活;如需激活配合 exchangeSelectedStream 方法使用。 这样你可以先挂N个字幕,然后根据需要让用户去切换。