Skip to content

Commit

Permalink
Bug fixes and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
goxr3plus committed Dec 27, 2018
1 parent 6355c0c commit 1c3a449
Show file tree
Hide file tree
Showing 4 changed files with 704 additions and 647 deletions.
19 changes: 14 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.goxr3plus</groupId>
<artifactId>java-stream-player</artifactId>
<version>1.1.0</version>
<version>8.0.0</version>


<properties>
Expand Down Expand Up @@ -72,12 +73,14 @@
<!-- Dependencies -->

<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.4.0-M1</version>
<scope>test</scope>
</dependency>

<!-- AUDIO SUPPORT -->
<dependency>
<groupId>com.googlecode.soundlibs</groupId>
Expand All @@ -99,6 +102,12 @@
<artifactId>tritonus-share</artifactId>
<version>0.3.7.4</version>
</dependency>
<dependency>
<groupId>com.googlecode.soundlibs</groupId>
<artifactId>tritonus-all</artifactId>
<version>0.3.7.2</version>
</dependency>

<!-- AUDIO EXPERIMENTAL TESTS -->
<!-- <dependency> <groupId>com.googlecode.soundlibs</groupId> <artifactId>tritonus-all</artifactId>
<version>0.3.7.2</version> </dependency> -->
Expand Down
96 changes: 96 additions & 0 deletions src/main/java/goxr3plus/javastreamplayer/application/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package main.java.goxr3plus.javastreamplayer.application;
/**
*
*/

import java.io.File;
import java.util.Map;

import main.java.goxr3plus.javastreamplayer.stream.StreamPlayer;
import main.java.goxr3plus.javastreamplayer.stream.StreamPlayerEvent;
import main.java.goxr3plus.javastreamplayer.stream.StreamPlayerException;
import main.java.goxr3plus.javastreamplayer.stream.StreamPlayerListener;

/**
* @author GOXR3PLUS
*
*/
public class Main extends StreamPlayer implements StreamPlayerListener {

private final String basePath = "C:\\Users\\GOXR3PLUSSTUDIO\\Desktop\\";
private final String audioAbsolutePath = basePath + "DJ WhiteO - Break Hard [mixtape] .stance.mp3";

/**
* Constructor
*/
public Main() {

try {

// Register to the Listeners
addStreamPlayerListener(this);

// Open a File
// open(new File("...")) //..Here must be the file absolute path
// open(INPUTSTREAM)
// open(AUDIOURL)

// Example
open(new File(audioAbsolutePath));
// Play it
play();

} catch (final StreamPlayerException ex) {
ex.printStackTrace();
}

}

/*
* (non-Javadoc)
*
* @see streamplayer.StreamPlayerListener#opened(java.lang.Object,
* java.util.Map)
*/
@Override
public void opened(final Object dataSource, final Map<String, Object> properties) {

}

/*
* (non-Javadoc)
*
* @see streamplayer.StreamPlayerListener#progress(int, long, byte[],
* java.util.Map)
*/
@Override
public void progress(final int nEncodedBytes, final long microsecondPosition, final byte[] pcmData,
final Map<String, Object> properties) {

System.out.println("Encoded Bytes : " + nEncodedBytes);

// Current time position in seconds:) by GOXR3PLUS STUDIO
// This is not the more precise way ... in XR3Player i am using different
// techniques .
// Just for demostration purposes :)
// I will add more advanced techniques with milliseconds , microseconds , hours
// and minutes soon
System.out.println("Current time is : " + (int) (microsecondPosition / 1000000) + " seconds");
}

/*
* (non-Javadoc)
*
* @see streamplayer.StreamPlayerListener#statusUpdated(streamplayer.
* StreamPlayerEvent)
*/
@Override
public void statusUpdated(final StreamPlayerEvent event) {
System.out.println(event.getPlayerStatus());
}

public static void main(final String[] args) {
new Main();
}

}
Loading

0 comments on commit 1c3a449

Please sign in to comment.