菜鸟教程小白 发表于 2022-12-11 19:47:37

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


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

<pre><code>MediaPlayer1.FileName := TPath.Combine(TPath.GetDocumentsPath,&#39;aSound.mp3&#39;);
MediaPlayer1.Play;
</code></pre>

<p>在 Windows 上运行良好。对于该应用程序的移动版本,我得到了帮助,以确定将声音文件从 <a href="https://community.embarcadero.com/article/articles-tutorials/151-ui/927-deploying-and-accessing-local-files-on-ios-and-android" rel="noreferrer noopener nofollow">this link</a> 放在哪里。 :</p>

<blockquote>
<p>Use the Project | Deployment menu item and select the Android and the
iOS Device platforms and for each one click the &#34;Add Files&#34; 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.</p>

<pre><code>For Android, set the Remote Path to .\assets\internal
For iOS, set the Remote Path to StartUp\Documents
</code></pre>
</blockquote>

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

<p>我在 <a href="https://stackoverflow.com/questions/32663131/how-to-deploy-ios-app-to-a-iphone-using-delphi-seattle-without-apple-developer-a#32665102" rel="noreferrer noopener nofollow">this SO question</a> 的帮助下将应用程序加载到 ios 设备上.该应用程序运行良好——除了没有声音。其他应用程序仍然可以发出声音,所以我知道问题不在于 iPad。我尝试将 iOS 声音文件部署路径设置为 <code>Startup\Documents\</code> 和 <code>StartUp\Documents</code> (Delphi 刚刚保存为 <code>Startup\Documents.</code>/p>

<p>我做错了什么?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>iOS 在远程路径上区分大小写,你写的 <code>Startup\Documents\</code> 必须是 <code>StartUp\Documents\</code></p>

<p>还总是包含一个检查,以确保文件在 <code>FileExists</code> 那里,如果找不到文件,您的应用可以相应地处理它。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何在 Delphi FireMonkey iOS 应用程序中存储和播放媒体文件?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/48965151/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/48965151/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何在 Delphi FireMonkey iOS 应用程序中存储和播放媒体文件?