stopping MediaPlayer

21 views
Skip to first unread message

stema...@gmail.com

unread,
May 31, 2017, 12:02:50 PM5/31/17
to CodenameOne Discussions
Hello,

I'm using the following code to add a MediaPlayer in a form and it works just fine:

Media m = MediaManager.createMedia("https://.............mp4", true);
f.add(BorderLayout.CENTER, new MediaPlayer(m));


On the same form I have a button which when clicked I navigate to another form using showForm(".......") but the video in the MediaPlayer doesn't stop (the sound is in the background). How can I stop it playing when I click that button?

It happens on simulator and actual device.

Thanks in advance.

Shai Almog

unread,
Jun 1, 2017, 1:13:04 AM6/1/17
to CodenameOne Discussions
Hi,
call stop on the media object before calling showForm.
Reply all
Reply to author
Forward
0 new messages