Play background music outside of app bundle using SimpleAudioEngine

孤街浪徒 提交于 2019-12-13 06:12:05

问题


I need to play background music residing in the app's document folder (using hosted content downloads which I put in the document folder after download).

It seems that SimpleAudioEngine's way of playing background music is to take a relative path and find it inside the app bundle (CDAudioManager does it):

@"mysong.mp3"

becomes

@"...19E17B5B/myapp.app/mysong.mp3"

Which is not helpful because the file saved into the Documents folder looks like this

@"...19E17B5B/Documents/mysong.mp3"

Edit: It works by specifying something like this @"../Documents/mysong.mp3"

However as we know this would not be recommended/future proof... Any better way to do this?


回答1:


It works by specifying a relative path like this @"../Documents/mysong.mp3", totally ignoring all recommended ways to get paths :-P



来源:https://stackoverflow.com/questions/17713490/play-background-music-outside-of-app-bundle-using-simpleaudioengine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!