Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public void play() throws StreamPlayerException {
try {
initLine();
} catch (final LineUnavailableException ex) {
throw new StreamPlayerException(StreamPlayerException.PlayerException.CAN_NOT_INIT_LINE, ex);
throw new StreamPlayerException(PlayerException.CAN_NOT_INIT_LINE, ex);
}

// Open the sourceDataLine
Expand Down Expand Up @@ -666,7 +666,7 @@ private void awaitTermination() {
Thread.sleep(20);
else
break;
System.out.println("StreamPlayer Future is not yet done...");
logger.log(Level.INFO, "StreamPlayer Future is not yet done...");
}

} catch (final InterruptedException ex) {
Expand Down Expand Up @@ -708,7 +708,7 @@ public long seekBytes(final long bytes) throws StreamPlayerException {

// Check if the requested bytes are more than totalBytes of Audio
final long bytesLength = getTotalBytes();
System.out.println("Bytes: " + bytes + " BytesLength: " + bytesLength);
logger.log(Level.INFO, "Bytes: " + bytes + " BytesLength: " + bytesLength);
if ((bytesLength <= 0) || (bytes >= bytesLength)) {
generateEvent(Status.EOM, getEncodedStreamPosition(), null);
return totalSkipped;
Expand All @@ -734,7 +734,7 @@ public long seekBytes(final long bytes) throws StreamPlayerException {
logger.info("Skipped : " + totalSkipped + "/" + bytes);
if (totalSkipped == -1)
throw new StreamPlayerException(
StreamPlayerException.PlayerException.SKIP_NOT_SUPPORTED);
PlayerException.SKIP_NOT_SUPPORTED);

logger.info("Skeeping:" + totalSkipped);
}
Expand Down Expand Up @@ -1281,7 +1281,7 @@ public void setBalance(final float fBalance) {
balanceControl.setValue(fBalance);
else
try {
throw new StreamPlayerException(StreamPlayerException.PlayerException.BALANCE_CONTROL_NOT_SUPPORTED);
throw new StreamPlayerException(PlayerException.BALANCE_CONTROL_NOT_SUPPORTED);
} catch (final StreamPlayerException ex) {
logger.log(Level.WARNING, ex.getMessage(), ex);
}
Expand Down Expand Up @@ -1387,4 +1387,7 @@ public boolean isSeeking() {
return status == Status.SEEKING;
}

Logger getLogger() {
return logger;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

import java.util.List;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.goxr3plus.streamplayer.enums.Status;

Expand All @@ -34,6 +36,7 @@
*/
public class StreamPlayerEventLauncher implements Callable<String> {

private final Logger logger;
/** The player state. */
private Status playerState = Status.NOT_SPECIFIED;

Expand Down Expand Up @@ -61,15 +64,15 @@ public class StreamPlayerEventLauncher implements Callable<String> {
* @param description
* the description
* @param listeners
* the listeners
*/
public StreamPlayerEventLauncher(Object source, Status playerStatus, int encodedStreamPosition, Object description,
List<StreamPlayerListener> listeners) {
public StreamPlayerEventLauncher(StreamPlayer source, Status playerStatus, int encodedStreamPosition, Object description,
List<StreamPlayerListener> listeners) {
this.source = source;
this.playerState = playerStatus;
this.encodedStreamPosition = encodedStreamPosition;
this.description = description;
this.listeners = listeners;
this.logger = source.getLogger();
}

@Override
Expand All @@ -79,8 +82,7 @@ public String call() {
listeners.forEach(listener -> listener
.statusUpdated(new StreamPlayerEvent(source, playerState, encodedStreamPosition, description)));
}

System.out.println("Stream player Status -> " + playerState);
logger.log(Level.INFO, "Stream player Status -> " + playerState);
return "OK";
}
}