You are not logged in.

  • "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