sonlichao opened a new issue, #1564:
URL: https://github.com/apache/cordova-ios/issues/1564

   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   Local media files should be accessible via `fileEntry.toURL()` URLs in HTML 
media elements (video, audio, img) on iOS 26, maintaining backward 
compatibility with existing Cordova apps.
   
   ### What does actually happen?
   On iOS 26, `fileEntry.toURL()` returns `file:///` URLs that cannot be loaded 
in media elements. The browser console shows:
   
   `WebContent[3,768] Could not create a sandbox extension for '<private>'`
   Media elements fail to load/play local files.
   
   ## Information
   
   ### Command or Code
   ```javascript
   // Save file using cordova-plugin-file
   window.resolveLocalFileSystemURL(cordova.file.tmpDirectory, (dirEntry) => {
       dirEntry.getFile(fileName, { create: true }, (fileEntry) => {
           fileEntry.createWriter((fileWriter) => {
               fileWriter.onwriteend = () => {
                   // Get URL using official API
                   const fileURL = fileEntry.toURL();
                   console.log(fileURL); 
                   // Output: 
file:///var/mobile/Containers/Data/Application/.../tmp/video.mp4
                   
                   // This fails on iOS 26 with sandbox error
                   document.getElementById('videoElement').src = fileURL;
               };
               fileWriter.write(blob);
           });
       });
   });
   
   ```
   
   Environment, Platform, Device
   
   Platform: iOS 26.0
   Device: iPhone SE (3rd generation)
   WebView: WKWebView (default)
   Configuration: Default Cordova setup (no custom scheme/hostname)
   
   Version information
   
   Cordova CLI: 12.0.0
   Cordova iOS: [7.1.0]
   Cordova Plugin File: 8.1.3
   
   Additional Context
   Working Configuration (with critical side effect):
   Adding scheme configuration makes file URLs work:
   
   ```
   <preference name="scheme" value="app" />
   <preference name="hostname" value="localhost" />
   ```
   
   
   However, this causes complete data loss:
   
   Then toURL() returns: app://localhost/_app_file_/... (works)
   However, this causes complete data loss:
   
   - Origin changes from null to app://localhost
   - All localStorage, IndexedDB, cookies are permanently lost
   - No migration path exists for user data
   
   
   This creates an impossible choice:
   
   Keep app working without scheme = No file access on iOS 26
   Add scheme configuration = Lose all user data
   
   Tested Scenarios
   
   ✅ Same code works on iOS 25 and earlier
   ✅ Same code works on all Android versions
   ❌ Manual URL conversion file:// to app:// fails (CSP error)
   ❌ File URLs fail in all locations (tmp, documents, cache)
   
   
   Checklist
   
   - [x]  I searched for existing GitHub issues
   - [x]  I updated all Cordova tooling to most recent version
   - [x]  I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to