Cordova Media Plugin无法在ios上打开文件

时间:2018-02-21 21:25:03

标签: javascript ios cordova cordova-plugins media

我正在使用带有cordova-plugin-media的ios和android系统上的cordova开发音频播放器应用程序。在Android版本上一切正常,但我无法在ios版本上打开文件。我总是收到错误MediaError.MEDIA_ERR_ABORTED,如下图所示:

Link to the picture

这就是我从控制台得到的:

AppName[24042:1570281] Will attempt to use file resource 'file:///Users/username/Library/Developer/CoreSimulator/Devices/7954CE22-7D19-4EFE-978F-A61E3CED4820/data/Containers/Data/Application/EBECDDE7-0415-4D1D-B152-F822FF320C49/Documents/products/92/Wielkie%20problemy%20ze%20snem%20malej%20slonicy%20Eli.mp3'
AppName[24042:1570281] Unknown resource 'file:///Users/username/Library/Developer/CoreSimulator/Devices/7954CE22-7D19-4EFE-978F-A61E3CED4820/data/Containers/Data/Application/EBECDDE7-0415-4D1D-B152-F822FF320C49/Documents/products/92/Wielkie%20problemy%20ze%20snem%20malej%20slonicy%20Eli.mp3'
AppName[24042:1570281] THREAD WARNING: ['Media'] took '70.802002' ms. Plugin should use a background thread.

我根据cordova.file.documentsDirectory从dirs读取mp3文件。但是当我将其更改为cordova.file.dataDirectory:

时,存在同样的问题
AppName[25764:1628569] Will attempt to use file resource 'file:///Users/username/Library/Developer/CoreSimulator/Devices/7954CE22-7D19-4EFE-978F-A61E3CED4820/data/Containers/Data/Application/5CBC0692-AC00-42B4-BA9A-5A21EBBF19F8/Library/NoCloud/products/92/Wielkie%20problemy%20ze%20snem%20malej%20slonicy%20Eli.mp3'
AppName[25764:1628569] Unknown resource 'file:///Users/username/Library/Developer/CoreSimulator/Devices/7954CE22-7D19-4EFE-978F-A61E3CED4820/data/Containers/Data/Application/5CBC0692-AC00-42B4-BA9A-5A21EBBF19F8/Library/NoCloud/products/92/Wielkie%20problemy%20ze%20snem%20malej%20slonicy%20Eli.mp3'
AppName[25764:1628569] THREAD WARNING: ['Media'] took '105.797607' ms. Plugin should use a background thread.

此文件存在,因为我可以访问它。媒体插件无法加载它。有什么办法可以解决这个问题吗?

0 个答案:

没有答案