AudioPlayerDemo with bugs (com falhas) #283
Replies: 16 comments 22 replies
-
Please replace the line of code with: LMusicPath := TPathHelper.GetAppPath('..\..\Music'); |
Beta Was this translation helpful? Give feedback.
-
Yes, I am looking into the other issues - they appear to be a problem on Android. All works on iOS |
Beta Was this translation helpful? Give feedback.
-
Now fixed the issue of the player completion on Android (Play will re-enable and Stop become disabled). You will need to update your copy of Kastri. |
Beta Was this translation helpful? Give feedback.
-
I've pushed changes to fix the looping issue. They were in the files:
|
Beta Was this translation helpful? Give feedback.
-
Inclusive até o "demo", também não está mais funcionando. |
Beta Was this translation helpful? Give feedback.
-
What "loop" are you referring to? In the demo, when music is playing, I can change the selection between the items in the list, click the Stop and Pause buttons, so there is no "freezing" there.
That has nothing to do with the code - it's an IDE issue.
The demo works fine here. On which platforms does it not work for you, and can you give more detail about exactly what is not "working"? |
Beta Was this translation helpful? Give feedback.
-
It sounds like the problem of freezing is in your code.
Even if you could, it would not help since I would not be able to see your code to identify the problem, and whether or not it's caused by the AudioPlayer feature.
Use the Pause method to pause the sound. For when the user switches away from or to your app, on mobile you can use Application Events (BecameActive, WillBecomeInactive). For example: https://en.delphipraxis.net/topic/5109-androidhow-to-make-an-event-listener/?do=findComment&comment=44442 |
Beta Was this translation helpful? Give feedback.
-
This is not the demo - it has no "RepeatSound" button. Please try the demo without modifying the code |
Beta Was this translation helpful? Give feedback.
-
I already linked to an example of how this can be achieved. You make the call to SubscribeToMessage when the form is created, and the call to Unsubscribe when it is destroyed. Note however, that on Windows, you may need to use OnActivate and OnDeactivate for the form that has the player.
I will look into this issue |
Beta Was this translation helpful? Give feedback.
-
I have made further changes to:
If you could try again, please. |
Beta Was this translation helpful? Give feedback.
-
I think I have it now. Sorry it has taken a bit to have this right. Changes again made to:
|
Beta Was this translation helpful? Give feedback.
-
The state of the MediaPlayer is different when Stop is called explicitly, as opposed to when the audio finishes, so I have made a change to:
|
Beta Was this translation helpful? Give feedback.
-
Then you have added something to your project that is causing that. Try the demo without any changes first |
Beta Was this translation helpful? Give feedback.
-
I tested your example project - it does not deploy GameBGPrincipal.mp3, so it locks up on start when attempting to load the file. |
Beta Was this translation helpful? Give feedback.
-
After adding a file to the project deployment, your test app works. |
Beta Was this translation helpful? Give feedback.
-
It works here every time I open and close the secondary form. Since I do not have your device, I can't say why it does not work on yours |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
O demonstrativo do AudioPlayerDemo, também está com problemas:
========
begin
{$IF Defined(MSWINDOWS)}
// LMusicPath := TPathHelper.GetDefaultSourcePath('Music');
{$ELSE}
========
erro:
Project AudioPlayerDemo.exe raised exception class $C0000005 with message 'access violation at 0x005a5718: read of address 0x00000000'.
cliquei no break e me levou para dentro de DW.AudioPlayer.Win, na linha FMediaEventEx:
O conteúdo das variáveis acima são:
Finalmente, após vários F9 (breakpoint), chegamos à última tela do erro:
Error
Access violation at address 005A5718 in module 'AudioPlayerDemo.exe'. Read of address 00000000.
OK
procedure TForm1.rectRepeatClick(Sender: TObject);
var
LPlayer: TAudioPlayer;
begin
LPlayer := GetSelectedPlayer;
// if LPlayer <> nil then
// begin
// if LPlayer.IsLooped then
// LPlayer.IsLooped := False
// else
// LPlayer.IsLooped := True
// end;
if rectRepeat.Tag = 0 then
begin
rectRepeat.Tag := 1;
rectRepeat.Fill.Color := $FFD30000;
LPlayer.IsLooped := True;
end
else
begin
rectRepeat.Tag := 0;
rectRepeat.Fill.Color := $FFE0E0E0;
LPlayer.IsLooped := False;
end;
end;
Vocês conseguem me ajudar?
Usando Delphi 12.1 CE Firemonkey.
The AudioPlayerDemo demo also has problems:
========
begin
{$IF Defined(MSWINDOWS)}
// LMusicPath := TPathHelper.GetDefaultSourcePath('Music');
{$ELSE}
========
error:
Project AudioPlayerDemo.exe raised exception class $C0000005 with message 'access violation at 0x005a5718: read of address 0x00000000'. ------------------------
I clicked on the break and it took me to DW.AudioPlayer.Win, to the FMediaEventEx line:
finally
FMediaEventEx.FreeEventParams(LCode, LParam1, LParam2);
end;
The contents of the variables above are:
Finally, after several F9 (breakpoint) presses, we reached the last error screen:
Error
Access violation at address 005A5718 in module 'AudioPlayerDemo.exe'. Read of address 00000000.
OK
procedure TForm1.rectRepeatClick(Sender: TObject);
var
LPlayer: TAudioPlayer;
begin
LPlayer := GetSelectedPlayer;
// if LPlayer <> nil then
//begin
// if LPlayer.IsLooped then
// LPlayer.IsLooped := False
//else
// LPlayer.IsLooped := True
// end;
if rectRepeat.Tag = 0 then
begin
rectRepeat.Tag := 1;
rectRepeat.Fill.Color := $FFD30000;
LPlayer.IsLooped := True;
end
else
begin
rectRepeat.Tag := 0;
rectRepeat.Fill.Color := $FFE0E0E0;
LPlayer.IsLooped := False;
end;
end;
Can you help me?
Using Delphi 12.1 CE Firemonkey.
Beta Was this translation helpful? Give feedback.
All reactions