Android上的Delphi Firemonkey应用程序在几次播放后都没有播放声音
我有问题在Android上播放声音文件。请参阅下面的我的代码,因为它可以正常运行近200次,但是听起来并没有出现。
我接收java.lang.runtimeException:setDatasource失败:stastus = 0x800000000。
有时它也会给我带来错误的java.oi.ioexception:准备失败。:状态= 0x1。
请让我知道下面的代码是否有任何问题,或者是否有人遇到此问题,请提供帮助。
谢谢
MediaPlayer1.FileName := System.IOUtils.TPath.Combine(System.IOUtils.TPath.GetPublicPath,'sound/Warning.3gp');
if MediaPlayer1.Media <> nil then
begin
MediaPlayer1.Play;
end;
注意:我已经从项目中删除了MediaPlayer1,并试图创建运行时间并在此之后销毁,但最终得到了完全相同的结果。
if(lMode=2) and (myQuery.RecordCount=0) then
begin
var mp : TMediaPlayer;
mp:=TMediaPlayer.Create(Self); // or AParent if it is a passed variable
mp.Parent:=Self; // (AParent) you must set its parent
mp.FileName := System.IOUtils.TPath.Combine(System.IOUtils.TPath.GetPublicPath,'sound/NOTFOUND.3gp');
if mp.Media <> nil then
begin
mp.Play;
end;
mp.Free;
end;
I having problem to play sound files on android. Please see below my code as it works fine up to nearly 200 times but after that sounds doesn't come up.
I receive java.lang.RuntimeException: setDataSource failed: stastus = 0x800000000.
And sometimes it also gives me error java.oi.IOException: Prepare failed.: status=0x1.
Please let me know if the code below has any problem or if anyone experienced this issue please help.
Thanks
MediaPlayer1.FileName := System.IOUtils.TPath.Combine(System.IOUtils.TPath.GetPublicPath,'sound/Warning.3gp');
if MediaPlayer1.Media <> nil then
begin
MediaPlayer1.Play;
end;
Note: I have removed the MediaPlayer1 from the project and tried to create run time and destroy after but ended up with exactly the same result.
if(lMode=2) and (myQuery.RecordCount=0) then
begin
var mp : TMediaPlayer;
mp:=TMediaPlayer.Create(Self); // or AParent if it is a passed variable
mp.Parent:=Self; // (AParent) you must set its parent
mp.FileName := System.IOUtils.TPath.Combine(System.IOUtils.TPath.GetPublicPath,'sound/NOTFOUND.3gp');
if mp.Media <> nil then
begin
mp.Play;
end;
mp.Free;
end;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论