fix(ios): fix text track selection by index (#3728)
* fix(ts): onPlaybackRateChangeData was not correctly typed * fix: ensure tracks are well displayed in the sample * fix(ios): text tracks selection by index. regression due to codegen rework * chore: make selection by index testable (need a small manual patch) * chore(ios): fix linter warning
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
struct SelectedTrackCriteria {
|
||||
let type: String
|
||||
let value: Any?
|
||||
let value: String?
|
||||
|
||||
let json: NSDictionary?
|
||||
|
||||
@@ -13,6 +13,6 @@ struct SelectedTrackCriteria {
|
||||
}
|
||||
self.json = json
|
||||
self.type = json["type"] as? String ?? ""
|
||||
self.value = json["value"]
|
||||
self.value = json["value"] as? String
|
||||
}
|
||||
}
|
||||
|
@@ -45,9 +45,11 @@ enum RCTPlayerOperations {
|
||||
}
|
||||
}
|
||||
} else if type == "index" {
|
||||
if let value = criteria?.value, let index = value as? Int {
|
||||
if textTracks.count > index {
|
||||
selectedTrackIndex = index
|
||||
if let value = criteria?.value { // check value is provided
|
||||
if let indexValue = Int(value as String) { // ensure value is an integer an String to Snt
|
||||
if textTracks.count > indexValue { // ensure value is in group range
|
||||
selectedTrackIndex = indexValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,9 +108,11 @@ enum RCTPlayerOperations {
|
||||
// } else if ([type isEqualToString:@"default"]) {
|
||||
// option = group.defaultOption; */
|
||||
} else if type == "index" {
|
||||
if let value = criteria?.value, let index = value as? Int {
|
||||
if group.options.count > index {
|
||||
mediaOption = group.options[index]
|
||||
if let value = criteria?.value { // check value is provided
|
||||
if let indexValue = Int(value as String) { // ensure value is an integer an String to Snt
|
||||
if group.options.count > indexValue { // ensure value is in group range
|
||||
mediaOption = group.options[indexValue]
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { // default. invalid type or "system"
|
||||
|
Reference in New Issue
Block a user