# Native audio error message

**URL:** <https://forum.ionicframework.com/t/native-audio-error-message/98360>\
**Category:** Ionic Native\
**Created:** [July 16, 2017, 11:42am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360 "2017-07-16T11:42:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cankaya](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@Cankaya](https://forum.ionicframework.com/u/Cankaya)\
**Post date:** [July 16, 2017, 11:42am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/1 "2017-07-16T11:42:59Z")

</div>

Hi

```auto
		this.platform.ready().then(() => {
			this.nativeAudio.preloadComplex(.....,....., 1, 1, 0)
						.then(() => {this.nativeAudio.play(.....);});			
			this.nativeAudio.play(.....);}

```

chrome://inspect  
First run

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/b/2/b2b1f23b165966a643689ee409912fa28bb72337.PNG)

after run

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/3/e/3e58ec88dde8446f655e977f46a45b7ddeff7b4d.PNG)  
why this error,I dont understand

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 17, 2017, 2:13pm UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/2 "2017-07-17T14:13:32Z")

</div>

My guess:  
First run: Your last line of the code you posted does the same as the line before, but outside of the `then` which doesn’t work as the preloading is not finished yet.  
Later runs: You can’t preload the same ID multiple times. You should probably check if it is already preloaded by catching the error in the Promise.

---

<div class="post-metadata">

**Author:** ![Cankaya](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@Cankaya](https://forum.ionicframework.com/u/Cankaya)\
**Post date:** [July 18, 2017, 7:18am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/4 "2017-07-18T07:18:30Z")

</div>

> [@Sujan12](#):
>
> Your last line of the code you posted does the same as the line before, but outside of the then which doesn’t work as the preloading is not finished yet.

How is first run error solution?  
only this code

```auto
this.platform.ready().then(() => {
			this.nativeAudio.preloadComplex(.....,....., 1, 1, 0)
						.then(() => {this.nativeAudio.play(.....);});}

```

sometimes dont working

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 18, 2017, 7:35am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/5 "2017-07-18T07:35:38Z")

</div>

I have no idea what you are saying.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 18, 2017, 7:54am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/7 "2017-07-18T07:54:14Z")

</div>

That has nothing to do with the thing this topic is about - specific error messages. Please open a new topic for this if you haven’t done so already.

---

<div class="post-metadata">

**Author:** ![Cankaya](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@Cankaya](https://forum.ionicframework.com/u/Cankaya)\
**Post date:** [July 18, 2017, 10:12am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/8 "2017-07-18T10:12:40Z")

</div>

Ok.

> [@Use native audio](https://forum.ionicframework.com/t/use-native-audio/98573):
>
> my question is general: ionViewWillEnter(){ this.no= this.navParams.get('no'); if(this.no==..){ .................. } else if(this.no==..){ .................. } else if(this.no==..){ .................. } else{} } } I want to audio file is changed depending on the situation(ionViewWillEnter).

---

<div class="post-metadata">

**Author:** ![Cankaya](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@Cankaya](https://forum.ionicframework.com/u/Cankaya)\
**Post date:** [July 18, 2017, 11:26am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/9 "2017-07-18T11:26:22Z")

</div>

First run: Your last line of the code you posted does the same as the line before, but outside of the then which doesn’t work as the preloading is not finished yet.

I mean I don’t need to write the last line

```auto
this.platform.ready().then(() => {
			this.nativeAudio.preloadComplex(.....,....., 1, 1, 0)
						.then(() => {this.nativeAudio.play(.....);});

```

but after come to same page.its dont work

---

<div class="post-metadata">

**Author:** ![Cankaya](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@Cankaya](https://forum.ionicframework.com/u/Cankaya)\
**Post date:** [July 19, 2017, 7:06am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/10 "2017-07-19T07:06:33Z")

</div>

```auto
this.platform.ready().then(() => {
			this.nativeAudio.preloadComplex(....,......, 1, 1, 0);
			this.nativeAudio.preloadComplex(.....,....., 1, 1, 0);
			this.nativeAudio.preloadComplex(.....,.....l, 1, 1, 0);
		});
	}

	

```

This is myPage.  
After diffrent page push the this myPage.And this same error.   
Thanks.

---

<div class="post-metadata">

**Author:** ![Cankaya](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@Cankaya](https://forum.ionicframework.com/u/Cankaya)\
**Post date:** [July 19, 2017, 7:24am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/11 "2017-07-19T07:24:49Z")

</div>

```auto
this.nativeAudio.preloadComplex(..................,................, 1, 1, 0);
this.nativeAudio.preloadComplex(..................,................, 1, 1, 0);
this.nativeAudio.preloadComplex(..................,................, 1, 1, 0);

```

what I need to write id

---

<div class="post-metadata">

**Author:** ![Cankaya](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@Cankaya](https://forum.ionicframework.com/u/Cankaya)\
**Post date:** [July 19, 2017, 7:53am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/12 "2017-07-19T07:53:54Z")

</div>

OK.I’m solved this error.  
Thank you to everyone who helped

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 19, 2017, 8:38am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/13 "2017-07-19T08:38:03Z")

</div>

Please post the solution and then select it as “solution” (checkbox under the post) so future visitors of your posts also can see how to fix the problem.

---

<div class="post-metadata">

**Author:** ![Cankaya](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@Cankaya](https://forum.ionicframework.com/u/Cankaya)\
**Post date:** [July 19, 2017, 8:50am UTC](https://forum.ionicframework.com/t/native-audio-error-message/98360/14 "2017-07-19T08:50:59Z")

</div>

I’m used to

```auto
this.nativeAudio.preloadComplex(..................,................, 1, 1, 0);

```

But same id [error.So](http://error.So) on Leave page

```auto
this.nativeAudio.unload(..........);

```

`unload(id)`==\>Unloads an audio file from memory
