Skip to content

Commit

Permalink
优化图片字幕选择
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslay committed Nov 19, 2023
1 parent 9da1097 commit 04367ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/KSPlayer/SwiftUI/KSVideoPlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,12 @@ struct VideoSettingView: View {
Picker(selection: Binding {
subtitleModel.selectedSubtitleInfo?.subtitleID
} set: { value in
subtitleModel.selectedSubtitleInfo = subtitleModel.subtitleInfos.first { $0.subtitleID == value }
let info = subtitleModel.subtitleInfos.first { $0.subtitleID == value }
subtitleModel.selectedSubtitleInfo = info
if let info = info as? MediaPlayerTrack {
// 因为图片字幕想要实时的显示,那就需要seek。所以需要走select track
config.playerLayer?.player.select(track: info)
}
}) {
Text("Off").tag(nil as String?)
ForEach(subtitleModel.subtitleInfos, id: \.subtitleID) { track in
Expand Down

0 comments on commit 04367ee

Please sign in to comment.