使用SimpleAudioEngine在应用程序包外播放背景音乐 [英] Play background music outside of app bundle using SimpleAudioEngine

查看:172
本文介绍了使用SimpleAudioEngine在应用程序包外播放背景音乐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要播放驻留在应用程式文件夹中的背景音乐(使用我下载后在文件夹中下载的代管内容下载)。

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).

看起来SimpleAudioEngine播放背景音乐的方式是采取相对路径,并在应用程序包内找到它(CDAudioManager这样做):

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"

成为

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

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

编辑:通过指定类似的东西@../ Documents / mysong .mp3

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?

推荐答案

它通过指定一个相对路径,如 @../ Documents / mysong.mp3忽略所有建议的方法来获取路径:-P

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

这篇关于使用SimpleAudioEngine在应用程序包外播放背景音乐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆