Restarting audio with MediaPlayer?
I've made a button that uses MediaPlayer to play a custom MP3 file that I've made.
This does work too. It's just that it only works once. Once I press the button again, nothing happens and I believe its because the audio is finished and needs to be restarted, but how would I do that?
15 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Ill try that
@PNTX I get this error: : 'The calling thread cannot access this object because a different thread owns it.'
obviously not related to your solution
yours probably works
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I already have that open lmfao
apparently this is the solution
but I have no clue where to put this...
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
The button is in another class. This is the function that is ran when someone clicks the mouse:
It works here for some reason
Oh and dispatcher doesn't exist in the other class for some reason.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ah
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yep
it does
the insance of the class that contains the sound is constructed on a different thread
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Ill check this out thanks
Arent
Task
and Threading
different?Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
one is a class and the other is a namespace
Oh...
I didnt notice lmfao