-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: 6.3.0 iOS crash at RCTVideoUtils function #4181
Comments
Thank you for your issue report. Please note that the following information is missing or incomplete:
Please update your issue with this information to help us address it more effectively.
There is a newer version of the library available. You are using version 6.3.0, while the latest stable version is 6.6.1. Please update to the latest version and check if the issue still exists.
|
Thank you for your issue report. Please note that the following information is missing or incomplete:
Please update your issue with this information to help us address it more effectively.
There is a newer version of the library available. You are using version 6.3.0, while the latest stable version is 6.6.1. Please update to the latest version and check if the issue still exists.
|
@NguyenHoangMinhkkkk Can you please test this patch ? I think code is a bit cleaner... diff --git a/ios/Video/Features/RCTVideoUtils.swift b/ios/Video/Features/RCTVideoUtils.swift
index 703b35fb..e213fdda 100644
--- a/ios/Video/Features/RCTVideoUtils.swift
+++ b/ios/Video/Features/RCTVideoUtils.swift
@@ -364,9 +364,10 @@ enum RCTVideoUtils {
guard let sourceUri = source.uri, sourceUri != "" else { return nil }
var asset: AVURLAsset!
let bundlePath = Bundle.main.path(forResource: source.uri, ofType: source.type) ?? ""
- let url = source.isNetwork || source.isAsset
- ? URL(string: source.uri ?? "")
- : URL(fileURLWithPath: bundlePath)
+ guard let url = source.isNetwork || source.isAsset
+ ? URL(string: sourceUri)
+ : URL(fileURLWithPath: bundlePath) else { return nil }
+
let assetOptions: NSMutableDictionary! = NSMutableDictionary()
if source.isNetwork {
@@ -375,9 +376,9 @@ enum RCTVideoUtils {
}
let cookies: [AnyObject]! = HTTPCookieStorage.shared.cookies
assetOptions.setObject(cookies as Any, forKey: AVURLAssetHTTPCookiesKey as NSCopying)
- asset = AVURLAsset(url: url!, options: assetOptions as? [String: Any])
+ asset = AVURLAsset(url: url, options: assetOptions as? [String: Any])
} else {
- asset = AVURLAsset(url: url!)
+ asset = AVURLAsset(url: url)
}
return (asset, assetOptions)
} |
@NguyenHoangMinhkkkk I created a PR with that change & much more fixes where ! are used: https://github.com/TheWidlarzGroup/react-native-video/pull/4182/files |
Version
6.3.0
What platforms are you having the problem on?
iOS
System Version
6.3.0
On what device are you experiencing the issue?
Real device, Simulator
Architecture
Old architecture
What happened?
I faced this issue while trying to open an .mkv video file from a Url that i dont know exaclty what is extension of file given.
and App error/crashes on iOS devices/simulators.
"error": {
"code": -11829,
"localizedDescription": "Cannot Open",
"localizedFailureReason": "This media may be damaged.",
"domain": "AVFoundationErrorDomain",
"localizedRecoverySuggestion": ""
}
At file: react-native-video/ios/Video/Features/RCTVideoUtils.swift, at line 380
Need to check the url variable =! nil
Reproduction Link
repository link
Reproduction
Here the patch i'm temporary using for avoid crash issue. while waiting for upgrade place into lastest RNVideo in future
The text was updated successfully, but these errors were encountered: