-
Notifications
You must be signed in to change notification settings - Fork 985
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
Reading big media files make WKWebView crash with cordova-ios-6.x #1033
Comments
Can you share an example project that we could use to debug the issue? |
@timbru31 Will do, I was looking for examples of stream-delivery with In this app I work with, we both support streaming and local playback of audiobooks, and since cordova-plugin-media did not support streaming, using the build in audio-tag in html5 worked well for both cases in the previous versions of cordova-ios. |
@timbru31 You can find an example here: https://www.dropbox.com/s/900pfcoouh9h9xl/mp3Player.zip?dl=0 The 700mb mp3-audio book is to big for a github-repo. Its embedded right into the app to keep the example simple. When running the app, you can click the
If you have the memory usage open, you will see a big spike. |
I can confirm the problem. We have an offline functionality in our app that downloads a video of roughly the same size. When using the generated path from |
Hello, |
Did research a lot if there was some way around this, but since you have to upgrade to WKWebView to work on the latests ios-versions and since cordova with WKWebView don't support a streamed reading of files, cordova is not longer an option if your app require these things. I migrated the app over to React Native. |
Thanks for reply |
Hello, I am still facing this issue. Is there any solution now? |
You can work around this issue with the cordova-httpd Plugin. The trick is to start a local web server on your device and fetch all bigger resources from there. Be careful when you bind to a port. It could actually already be taken so you will need some fallback strategy, like trying another port until you found a free one. |
Thank you! I will give it a try... |
I think that this issue is related to WKWebView itself. See this WebKit issue, that has been fixed but not landed yet in iOS. I have tried with iOS 15.4.1 and the memory usage is still huge. So I guess that it will be fixed in a future iOS release, but I don't know which one. |
Is this fixed with iOS 16? |
Range headers are now included in the WKURLSchemeTask headers on recent versions of iOS, but this is still an issue because the Range headers need to actually be handled in the Scheme Handler. There's a PR on the Ionic webview plugin (ionic-team/cordova-plugin-ionic-webview#692) that looks promising as far as implementing that logic, so we should be able to try something similar here. |
Based on code from ionic-team/cordova-plugin-ionic-webview#692 Closes apacheGH-1033. Co-Authored-By: David Holmgren <[email protected]>
Based on code from ionic-team/cordova-plugin-ionic-webview#692 Closes apacheGH-1033. Co-Authored-By: David Holmgren <[email protected]>
Based on code from ionic-team/cordova-plugin-ionic-webview#692 Closes apacheGH-1033. Co-Authored-By: David Holmgren <[email protected]>
Based on code from ionic-team/cordova-plugin-ionic-webview#692 Closes apacheGH-1033. Co-Authored-By: David Holmgren <[email protected]>
Bug Report
After migration from cordova-ios-5.x to cordova-ios-6.x we now see that the cordova no longer support reading files in chunks. Instead the whole file is loaded into memory, which will limit file access to what is available on your device.
Problem
After what I can see, it looks like CDVURLSchemeHandler is handling access of local files in a cordova app, and it does not support delivering files with range headers so WKWebView don't need to load the whole file at once.
What is expected to happen?
Earlier with UIWebView we did not experience this so I guess that cordova on UIWebView handled this by reading these files in chunks. (Or it was packed with the default file-reading that UIWebView had)
What does actually happen?
Running simulator or a device attached to xcode we see a memory spike at the same size as the file you try to access. If you are on a device that can not handle this, it will result in a restart of the webview.
Information
Think the same problem is reported here for cordova-plugin-ionic-webview
Version information
[email protected]
Checklist
The text was updated successfully, but these errors were encountered: