ios - 如何在 Delphi FireMonkey iOS 应用程序中存储和播放媒体文件?

标签 ios delphi media-player firemonkey delphi-10.1-berlin

我写了一个 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。

我做错了什么?

最佳答案

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

还始终包括一个检查以确保文件存在于 FileExists 中,如果找不到该文件,您的应用可以相应地处理它。

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

相关文章:

ios - 如何将UIImagePicker图像转换为字节数组Objective-C

ios - 为什么纹理表面的透明和不透明区域之间存在暗边/光晕(在 opengl es 2.0 片段着色器中)

android - Android,按下按钮时音乐播放滞后

audio - 在M3U播放列表中指定文件的相对路径的正确方法是什么?

android - Android:Imagebutton,onclick播放声音

iphone - 需要帮助在 UIView 中正确定位 UIView

ios - Xcode 10,iOS : Test build failed even when all Tests have passed

切换主题时 Delphi VCL 应用程序布局发生变化

delphi - 将 TDateTime 转换为另一个时区,无论本地时区如何

delphi - 用于调试器的单独鼠标