breautek commented on issue #628: URL: https://github.com/apache/cordova-plugin-file/issues/628#issuecomment-2589808474
> and the result of console.log of reader.onloadend is: "File letto con successo: -ArrayBuffer (byteLenght: 15310703, resizable: false, maxByteLenght: 15310703... This looks like it worked as intended, it has an ArrayBuffer filled with bytes. The array buffer alone isn't usable but you can wrap it around a `Blob` (`new Blob([arrayBuffer])`) and then use `URL.createObjectURL(blob)`. HOWEVER this is very inefficient and you'll need to use `URL.revokeObjectURL` after you don't need it anymore, as it will force the video file to be retained in memory which will be quite a serious memory leak considering how large videos are. > Also tryed using the workaround u gave me with WkWebView.convertFilePath(theFilePath); but i didnt understand how to use it. Using WkWebView.convertFilePath(theFilePath); is definitely a better path. The output of `convertFilePath` is a source string that can be used directly in the DOM. `WkWebView.convertFilePath` is a iOS-specific API however, so instead of using it directly, you should use the `FileEntry.toURL()` API, which allows you to be platform independent. Suppose you had a `<video id="myVideo" />` tag somewheres in your HTML, here is an example: ```javascript loadCachedVideo(v) { if (!v) { console.error("Il parametro 'v' รจ vuoto."); return null; } const videoUrl = this.cacheDirectory + this.getFileName(v); console.log('video url: ' + videoUrl); window.resolveLocalFileSystemURL(videoUrl, (fileEntry) => { const videoElement = document.getElementByID("myVideo"); videoElement.src = fileEntry.toURL(); videoElement.play(); }); }); ``` Note that I'd recommend using file plugin 8.1.3 as it contains fixes surrounding `.toURL()` usage on iOS. Earlier versions will not work if you're also using schemes (e.g. app is hosted on `app://` or something other than `file://`) -- 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-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org