OGeek|极客世界-中国程序员成长平台

标题: ios - 如何在 Delphi FireMonkey iOS 应用程序中存储和播放媒体文件? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:47
标题: ios - 如何在 Delphi FireMonkey iOS 应用程序中存储和播放媒体文件?

我编写了一个 FireMonkey 应用程序(Delphi 10.1 Berlin),其中包括声音,通过 TMediaPlayer 播放的 mp3:

MediaPlayer1.FileName := TPath.Combine(TPath.GetDocumentsPath,'aSound.mp3'); 
MediaPlayer1.Play;

在 Windows 上运行良好。对于该应用程序的移动版本,我得到了帮助,以确定将声音文件从 this link 放在哪里。 :

Use the Project | Deployment menu item and select the Android and the iOS Device platforms and for each one click the "Add Files" button in the local toolbar to select the bitmap file to deploy with the app and set the Remote Path column value for each platform.

For Android, set the Remote Path to .\assets\internal
For iOS, set the Remote Path to StartUp\Documents

将文件添加到 \assets\internal 以进行 Android 部署也可以正常工作 - 声音按预期播放。

我在 this SO question 的帮助下将应用程序加载到 ios 设备上.该应用程序运行良好——除了没有声音。其他应用程序仍然可以发出声音,所以我知道问题不在于 iPad。我尝试将 iOS 声音文件部署路径设置为 Startup\Documents\StartUp\Documents (Delphi 刚刚保存为 Startup\Documents./p>

我做错了什么?



Best Answer-推荐答案


iOS 在远程路径上区分大小写,你写的 Startup\Documents\ 必须是 StartUp\Documents\

还总是包含一个检查,以确保文件在 FileExists 那里,如果找不到文件,您的应用可以相应地处理它。

关于ios - 如何在 Delphi FireMonkey iOS 应用程序中存储和播放媒体文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48965151/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4