Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

<<<<<<< HEAD
### Changed

- Conviva
- Bumped the Conviva SDK dependency to 4.2.4.
=======
### Fixed

- SideloadedSubtitle
- Fixed an issue where the stream would not play if an invalid subtitle source is passed and activated.
>>>>>>> 22a7075 (add changelog)

## [10.4.0] - 2025-11-05

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,25 @@ extension URL {
}
return URL(string: self.absoluteString.replacingCharacters(in: range, with: newScheme + "://"))
}

var isValid: Bool {
guard self.scheme != nil else {
print("[AVSubtitlesLoader] URL scheme is invalid or missing.")
return false
}

guard let host = self.host,
!host.isEmpty else {
print("[AVSubtitlesLoader] URL host is invalid or missing.")
return false
}

let disallowedCharacterSet = CharacterSet.urlQueryAllowed.inverted
guard self.absoluteString.rangeOfCharacter(from: disallowedCharacterSet) == nil else {
print("[AVSubtitlesLoader] URL contains invalid characters.")
return false
}

return true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class MasterPlaylistParser: PlaylistParser {
var constructedManifestArray = [String]()
fileprivate var lastMediaLine: Int?
fileprivate let subtitlesGroupId = "THEOsubs"

override init(url: URL) {
super.init(url: url)
}
Expand Down Expand Up @@ -58,7 +59,7 @@ class MasterPlaylistParser: PlaylistParser {
case HLSKeywords.subtitles.rawValue:
line.paramsObject[HLSKeywords.groupId.rawValue] = "\"\(self.subtitlesGroupId)\""
self.lastMediaLine = self.constructedManifestArray.count

default:
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ class SourceValidator {
return nil
}

let filteredTextTracks = sideLoadedTextTracks.filter { $0.kind == .subtitles }
let subtitlesTextTracks = sideLoadedTextTracks.filter { $0.kind == .subtitles }
let filteredTextTracks = subtitlesTextTracks.filter { subtitle in
guard subtitle.src.isValid == true else {
print("[AVSubtitlesLoader] The provided subtitle source \(subtitle.src.absoluteString) is invalid.")
return false
}
return true
}
if filteredTextTracks.isEmpty {
print("[AVSubtitlesLoader] Unable to find a valid TextTrackDescription for sideloading.")
return nil
Expand Down
Loading