0

I am having trouble with Cordova Media Capture where I get an error saying:

enter image description here

This happens after I take a video and try to display it. The video player seems to record fine but the file doesn't play. I looked in the console and found the above error.

I found a solution that I think will work:

http://www.agiliztech.com/2017/06/29/retrieve-audio-video-file-ionic-2-app/

but in the code he has a line that says File.copyFile(). I don't know what library this is coming from. Does anyone know?

enter image description here

Also, does anyone know the root cause of my problem? Or is there a JS alternative to what he is doing that I can use if you don't know what File.copyFile is?

I am currently getting the error File.copyFile is not a function - Which it's not a function...

Thanks.

MatTaNg
  • 923
  • 8
  • 23
  • 41
  • At which browser are you trying code? – guest271314 Aug 16 '17 at 02:54
  • I'm making a WebApp, i'm trying to get it to work on Android. But I am inspecting it using Chrome – MatTaNg Aug 16 '17 at 03:32
  • Chrome, Chromium does not allow access to `file:` protocol by default, see [Read local XML with JS](https://stackoverflow.com/questions/41279589/read-local-xml-with-js/) – guest271314 Aug 16 '17 at 03:34
  • So I would need to test this on Chromium instead of Chrome and change the defaults of my Chromium browser to allow access to the file: protocol? Would the users of my app get this problem? Would the tutorial above not work? – MatTaNg Aug 16 '17 at 03:47
  • Chrome is built using Chromium source code. You can adjust launcher to `Chrome --allow-file-access-from-files` for local testing. – guest271314 Aug 16 '17 at 03:57
  • Okay, I'll try that thanks – MatTaNg Aug 16 '17 at 04:01
  • According to this post https://stackoverflow.com/questions/18586921/how-to-launch-html-using-chrome-at-allow-file-access-from-files-mode that flag is dangerous. I did an npm install on http-server then did a http-server -p 8100 to start up the server. Then I opened another command prompt and did an ionic run android. It still doesn't work. The ports match. Did I do this right? – MatTaNg Aug 16 '17 at 04:30
  • Do you mean according to one answer at the linked Question? The flag can used for local development. – guest271314 Aug 16 '17 at 04:53
  • I don't think i'm understanding this. I cd'd to the folder containing my Chrome.exe and ran "chrome --allow-file-access-from-files". This opened up a new chrome browser which looks the same as before. I am using this URL to see the errors in my device: chrome://inspect/#devices. So I put that URL into the new opened browser hit inspect however, I still receive the same error. – MatTaNg Aug 17 '17 at 02:51
  • This was following my link as I was confused at what 'usr' was all about. My terminal could not find that folder – MatTaNg Aug 17 '17 at 02:52
  • 1
    Did you have an open instance of Chrome running when you launched using flag? If yes, Chrome will launch using the existing running instance folder if `--user-data-dir` flag is not set to a different configuration folder. Or close all open instances of Chrome and launch using `--allow-file-access-from-files` flag set. – guest271314 Aug 17 '17 at 05:40
  • Wow that actually worked - Looks incredible Thanks! – MatTaNg Aug 18 '17 at 00:32

0 Answers0