You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "DUWENINK (via GitHub)" <gi...@apache.org> on 2023/09/04 10:40:43 UTC

[GitHub] [cordova-plugin-file] DUWENINK opened a new issue, #602: How can I parse a mideastore path to cdvfile protocol ?

DUWENINK opened a new issue, #602:
URL: https://github.com/apache/cordova-plugin-file/issues/602

   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
    I use my plugin to record the screen can I save it to gallery ,  and I want to display it on device  at the same time,my device load a remote url like 'https://192.168.1.113:7702/MobileServer/dist/index.html',I use this code 
    ```
   this.convertToCdvfile = function (path) {
       var get = new Promise((resolve, reject) => {
           try {
               window.resolveLocalFileSystemURL(path, function (fileEntry) {
                   var cdvfilePath = fileEntry.toURL();
                   console.log("convertToCdvfile:" + JSON.stringify(fileEntry));
                   resolve(cdvfilePath);
               }, function (error) {
                   reject('ERROR: ' + JSON.stringify(error));
               });
           }
           catch (ex) {
               reject('ERROR: ' +  JSON.stringify(ex));
           }
       });
       return get;
   };
   ```
   and then  I get
   ```
   convertToCdvfile:{"isFile":true,"isDirectory":false,"name":"366","fullPath":"/media/external/video/media/366","filesystem":"<FileSystem: content>","nativeURL":"content://media/external/video/media/366"}
   cordova-funcs.js:991
   convertToCdvfile:content://media/external/video/media/366->https://192.168.1.113:7702/__cdvfile_content__/media/external/video/media/366
   ``` 
   the filepath I can not set to the src to the video
   
   and also
   i get list of paths just like
   'https://192.168.1.113:7702/__cdvfile_content__/media/external/video/media/366'
   'content://media/external/video/media/357'
   'file:///storage/emulated/0/Movies/PR-DC/DWK_6b62dfc0-83c8-4294-9065-d1080bab8a1d.mp4'
   `file:///storage/emulated/com.duwenink.app/Movies/PR-DC/DWK_5b029226-68e9-4441-9082-8499a488cc70.mp4`
   `https://192.168.1.113:7702/__cdvfile_content__/media/external/video/media/357`
   `https://192.168.1.113:7702/__cdvfile_sdcard__/Movies/PR-DC/DWK_6b62dfc0-83c8-4294-9065-d1080bab8a1d.mp4`
   
   i try many ways but why i can not the the cdvfile easily????????????????????????????????????
   


-- 
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: issues-unsubscribe@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek closed issue #602: How can I parse a mideastore path to cdvfile protocol ?

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek closed issue #602: How can I parse a mideastore path to cdvfile protocol ?
URL: https://github.com/apache/cordova-plugin-file/issues/602


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #602: How can I parse a mideastore path to cdvfile protocol ?

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #602:
URL: https://github.com/apache/cordova-plugin-file/issues/602#issuecomment-1705090205

   If you're expecting a `cdvfile://` path, that's not really supported anymore due to CORs. I believe `cdvfile://` is still used on file-based hosted app content, but on scheme/http (WebViewAssetLoader) hosted app content, it retains the origin and have the app route to the local path.
   
   Normally the path `https://<app-host>/__cdvfile_sdcard__/Movies/PR-DC/DWK_6b62dfc0-83c8-4294-9065-d1080bab8a1d.mp4` is handled by the WebViewAssetLoader, which parses the `__cdvfile_sdcard_` part to know where to redirect the rest of the path to the local filesystem.
   
   However you're using a remote web resource as your app, so you're not using the `WebViewAssetLoader`, which isn't really a supported configuration. Additionally, your remote web server won't have access to local device files to actually serve that content. The app needs to be hosted through the locally through the WebViewAssetLoader (which means your app web assets like your `index.html` and JS, etc needs to be on the local device, not served remotely) for the cdv file work.
   
   But if you're using external storage mediums (e.g. `/storage/emulated/0/`, there are a [several other issues](https://github.com/apache/cordova-plugin-file#androids-external-storage-quirks) with using a file-based API due to Android's scoped storage mechanism). So, I'd also consider using a [media-store plugin](https://www.npmjs.com/search?q=ecosystem%3Acordova%20storage%20access%20framework), although I'm not sure if it will solve all of your issues given your current environment.
   
   Closing as won't fix.


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org