arielfaur / ionic-audio

An audio player for Ionic 3 and Angular 4. Works with HTML 5 audio or native audio using Cordova Media plugin.
http://arielfaur.github.io/ionic-audio/2.0/index.html
MIT License
321 stars 163 forks source link

Not Playing Saved Audio file on iPhone #164

Closed Eaderibigbe closed 6 years ago

Eaderibigbe commented 7 years ago

Hello, I am implementing version 3.2.0 and streaming from a url is ok but playing a saved audio file is not working on iPhone but working on android. I tried both cordova and web audio. Below is error I got as I will appreciate your help.

Audio error => track file:///var/mobile/Containers/Data/Application/4286D16E-3EE4-41B4-93FC-9FE4749552C1/Documents/M950.mp3 [object Object] 2017-10-31 09:15:07.588967+0100 RCCG LAP[1443:642590] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid number value (NaN) in JSON write'

Kindly note that the file is on the device

2017-10-31 09:15:06.552694+0100 RCCG LAP[1443:642590] Loading track file:///var/mobile/Containers/Data/Application/4286D16E-3EE4-41B4-93FC-9FE4749552C1/Documents/M950.mp3 2017-10-31 09:15:06.555248+0100 RCCG LAP[1443:643619] Will attempt to use file resource 'file:///var/mobile/Containers/Data/Application/4286D16E-3EE4-41B4-93FC-9FE4749552C1/Documents/M950.mp3' 2017-10-31 09:15:06.555487+0100 RCCG LAP[1443:643619] Unknown resource 'file:///var/mobile/Containers/Data/Application/4286D16E-3EE4-41B4-93FC-9FE4749552C1/Documents/M950.mp3' 2017-10-31 09:15:06.572677+0100 RCCG LAP[1443:642590] Audio error => track file:///var/mobile/Containers/Data/Application/4286D16E-3EE4-41B4-93FC-9FE4749552C1/Documents/M950.mp3 [object Object] 2017-10-31 09:15:07.588967+0100 RCCG LAP[1443:642590] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid number value (NaN) in JSON write' First throw call stack: (0x18426fd38 0x183784528 0x18426fc80 0x184cef4c0 0x184cee044 0x184cf0688 0x18420942c 0x184cefda8 0x184ceddf4 0x184ceee44 0x104a78884 0x104a83444 0x104a782c8 0x104a6a494 0x104a82200 0x104953dd8 0x104953c3c 0x10495581c 0x193553250 0x1934e7e00 0x1934e9fe0 0x1932d5b10 0x1934b2820 0x1932960ec 0x193298ae0 0x18b49cd10 0x18b49cfd0 0x184218358 0x1842182d8 0x184217b60 0x184215738 0x1841362d8 0x185fc7f84 0x18d6e3880 0x104922cfc 0x183c5a56c) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

mubasshir commented 7 years ago

did you get any solution for this?

Eaderibigbe commented 7 years ago

Not at all

On Tue, 21 Nov 2017 at 3:10 PM, Mubasshir Pawle notifications@github.com wrote:

did you get any solution for this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arielfaur/ionic-audio/issues/164#issuecomment-346055927, or mute the thread https://github.com/notifications/unsubscribe-auth/AAr5jNnZ0FoY5Qif5CYT1UNpHhGcXzJKks5s4uflgaJpZM4QNKRP .

mubasshir commented 7 years ago

what did you do then?

Eaderibigbe commented 7 years ago

For IOS I removed option of saving audio file to be played later but for iOS you can save file locally and play latter

On Wed, 22 Nov 2017 at 8:28 AM, Mubasshir Pawle notifications@github.com wrote:

what did you do then?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arielfaur/ionic-audio/issues/164#issuecomment-346277887, or mute the thread https://github.com/notifications/unsubscribe-auth/AAr5jM2MUXUakADnI3wPqqTpnIWGKRzXks5s49s1gaJpZM4QNKRP .

mubasshir commented 7 years ago

I'm bit confused with your reply.

hphirke commented 7 years ago

@adedapo Could you explain what you mean by:

for iOS you can save file locally and play latter

I am also looking for an app which can download and play audio locally but getting an error

Eaderibigbe commented 7 years ago

Hello Samething I wish to implement. On Android I was able to download the audio and play locally. On iOS, I was also able to download but couldn't play locally reason I opened the issue.

I am looking at removing the option to download and play locally from the iOS version.

Hope it helps

On Wed, Nov 22, 2017 at 9:33 AM, Himanshu Phirke notifications@github.com wrote:

@adedapo https://github.com/adedapo Could you explain what you mean by:

for iOS you can save file locally and play latter

I am also looking for an app which can download and play audio locally but getting an error

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arielfaur/ionic-audio/issues/164#issuecomment-346279091, or mute the thread https://github.com/notifications/unsubscribe-auth/AAr5jDR1h0FaN0CrbSIUBnsROL1GKpE2ks5s49xzgaJpZM4QNKRP .

borodiliz commented 6 years ago

Same problem here. It was a headache, but I finally found the solution:

import {IonicAudioModule, WebAudioProvider, CordovaMediaProvider, defaultAudioProviderFactory} from 'ionic-audio';
...
export function myCustomAudioProviderFactory() {
   //Just for testing, force to use CordovaMediaProvider
   return new CordovaMediaProvider();
}
....
   //Just for testing, move to defaultAudioProviderFactory after validating 
IonicAudioModule.forRoot(myCustomAudioProviderFactory),

Probably also solves #92

@arielfaur Should ionic-audio work with local files using WebAudioProvider on IOS?

mubasshir commented 6 years ago

@borodiliz I will definitely check this, thanks

arielfaur commented 6 years ago

168

Have you checked the file path? There are lots of issues related to the same topic. Please try not to create duplicate issues. In most cases this is due to a wrong path. Take a look at the File plugin which has constants that map to the appropriate path on Android and iOS.