nstudio / nativescript-audio

:microphone: NativeScript plugin to record and play audio :musical_note:
Other
149 stars 104 forks source link

ios NSOSStatusErrorDomain #203

Open bradrice opened 2 months ago

bradrice commented 2 months ago

I'm getting this error:

0m Error trying to play from url Error Domain=NSOSStatusErrorDomain Code=1954115647 "(null)"

It doesn't happen for all my audio, but for a couple of mp3's. However, I can play them in the browser. Any idea why I might be getting this in the nativescript-audioplayer for ios? Also, the same file plays ok in android using the plugin.

b44rd commented 1 month ago

Experiencing the same issue. Sample mp3 file can be downloaded here.

const audio = require('nativescript-audio')

export default Vue.extend({
  mounted() {
    const player = new audio.TNSPlayer()
              player.playFromFile({
                    audioFile: "~/audio/sound.mp3",
                    loop: false,
                    autoPlay: true,
                }).then(res => {
                    console.log(res);
                })
                .catch(err => {
                    console.log('something went wrong...', err);
                })

  }
})

Packages: "dependencies": { "@nativescript/core": "8.6.2", "@nativescript/theme": "3.0.2", "nativescript-audio": "^6.2.6", "nativescript-vue": "2.9.3" }, "devDependencies": { "@nativescript/android": "8.6.2", "@nativescript/ios": "next", "@nativescript/types": "8.6.1", "@nativescript/webpack": "5.0.18", "@types/node": "17.0.21", "nativescript-vue-template-compiler": "2.9.3", "typescript": "4.8.4", "vue": "2.6.12" }

b44rd commented 1 month ago

In my case, I had placed the file within a ~/audio folder. I moved it to the ~/assets directory, and it worked. Could be as simple as that this issue occurs when the file path is wrong.