This Java tip illustrates a method of determining When a Midi audio player has finished playing. Developer may use this in gaming applications where there is a need for playing different audios. Further this may also be used in your own media player. Here in this tip a sequencer fires a meta message event when a midi file has finished playing.

 // Add a listener for meta message events
        new MetaEventListener() {
            public void meta(MetaMessage event) {
                if (event.getType() == 47) {
                    // Sequencer is done playing