gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:04:10 29 4
gpt4 key购买 nike

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

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com