You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "rucksacktraeger" started this thread

Posts: 14

Date of registration: Mar 18th 2014

  • Send private message

1

Monday, March 24th 2014, 6:09pm

Set a Listener event on audio file

Hey,

I improved the code from here to let my program play mp3 files. That worked great with JLayer. But I spend the whole afternoon to implement pause/resume. I am prette sure the I found here the solution :

AdvancedPlayer player = new AdvancedPlayer(fis);
player.setPlayBackListener(new PlaybackListener() {
@Override
public void playbackFinished(PlaybackEvent event) {
pausedOnFrame = event.getFrame();
}
});

But I failed to bring the Listener to jabaco. here is what I have:

Jabaco Source

1
2
3
4
5
Dim p As AdvancedPlayer Dim pLis As PlaybackListener Dim pEvent As PlaybackEvent 

'Direct startPublic Sub run()    Dim f As New FileInputStream(strMp3File)    p = New AdvancedPlayer(f)    p.setPlayBackListener(pLis)   p.playEnd Sub 
Public Sub playbackFinished(evFin As PlaybackEvent)   lastPos = evFin.getFrame End Sub
'StopPublic Sub Mp3Stop()   If p <> Nothing Then       p.close    End IfEnd Sub



But I don't know how to fire playBackFinished without getting an Error saying NullPointerException at lastPos = evFin.getFrame

Any ideas out there?
Peter

Rate this thread
WoltLab Burning Board