V
V
Volodar Znatsky2018-05-20 18:48:56
Java
Volodar Znatsky, 2018-05-20 18:48:56

How to play an excerpt of a song with the java jlayer player library?

It is necessary to play the song not from the very beginning, but from the Nth second. How can this be implemented?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Volodar Znatsky, 2018-06-03
@ja8mraz

Import libraries:

import java.io.FileInputStream;
import javazoom.jl.player.advanced.*;
import javazoom.jl.player.*;

AdvancedPlayer ap;
InputStream is=new FileInputStream(song);
AudioDevice device=new JavaSoundAudioDevice();
ap=new AdvancedPlayer(is,device);
ap.play(int start, int end);
ap.stop();
ap.close();

Using AdvancedPlayer, you can solve the problem. ap.play allows you to specify from what and at what moment the song should be played.

D
Dmitry Alexandrov, 2018-05-21
@jamakasi666

Open documentation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question