Skip to content

Commit

Permalink
Merge pull request #309 from birdmichael/master
Browse files Browse the repository at this point in the history
fix #67 fix showSubtile bug
  • Loading branch information
BrikerMan committed Jul 1, 2020
2 parents 8c7f1bf + b2679b9 commit f84c675
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Source/BMPlayerControlView.swift
Expand Up @@ -128,9 +128,7 @@ open class BMPlayerControlView: UIView {
currentTimeLabel.text = BMPlayer.formatSecondsToString(currentTime)
totalTimeLabel.text = BMPlayer.formatSecondsToString(totalTime)
timeSlider.value = Float(currentTime) / Float(totalTime)
if let subtitle = resource?.subtitle {
showSubtile(from: subtitle, at: currentTime)
}
showSubtile(from: resource?.subtitle, at: currentTime)
}


Expand Down Expand Up @@ -447,8 +445,8 @@ open class BMPlayerControlView: UIView {


// MARK: - private functions
fileprivate func showSubtile(from subtitle: BMSubtitles, at time: TimeInterval) {
if let group = subtitle.search(for: time) {
fileprivate func showSubtile(from subtitle: BMSubtitles?, at time: TimeInterval) {
if let subtitle = subtitle, let group = subtitle.search(for: time) {
subtitleBackView.isHidden = false
subtitleLabel.attributedText = NSAttributedString(string: group.text,
attributes: subtileAttribute)
Expand Down

0 comments on commit f84c675

Please sign in to comment.