Skip to content

Commit 1c3a449

Browse files
committed
Bug fixes and updates
1 parent 6355c0c commit 1c3a449

File tree

4 files changed

+704
-647
lines changed

4 files changed

+704
-647
lines changed

pom.xml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
34
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56

67
<groupId>com.github.goxr3plus</groupId>
78
<artifactId>java-stream-player</artifactId>
8-
<version>1.1.0</version>
9+
<version>8.0.0</version>
910

1011

1112
<properties>
@@ -72,12 +73,14 @@
7273
<!-- Dependencies -->
7374

7475
<dependencies>
76+
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
7577
<dependency>
76-
<groupId>junit</groupId>
77-
<artifactId>junit</artifactId>
78-
<version>3.8.2</version>
78+
<groupId>org.junit.jupiter</groupId>
79+
<artifactId>junit-jupiter-api</artifactId>
80+
<version>5.4.0-M1</version>
7981
<scope>test</scope>
8082
</dependency>
83+
8184
<!-- AUDIO SUPPORT -->
8285
<dependency>
8386
<groupId>com.googlecode.soundlibs</groupId>
@@ -99,6 +102,12 @@
99102
<artifactId>tritonus-share</artifactId>
100103
<version>0.3.7.4</version>
101104
</dependency>
105+
<dependency>
106+
<groupId>com.googlecode.soundlibs</groupId>
107+
<artifactId>tritonus-all</artifactId>
108+
<version>0.3.7.2</version>
109+
</dependency>
110+
102111
<!-- AUDIO EXPERIMENTAL TESTS -->
103112
<!-- <dependency> <groupId>com.googlecode.soundlibs</groupId> <artifactId>tritonus-all</artifactId>
104113
<version>0.3.7.2</version> </dependency> -->
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package main.java.goxr3plus.javastreamplayer.application;
2+
/**
3+
*
4+
*/
5+
6+
import java.io.File;
7+
import java.util.Map;
8+
9+
import main.java.goxr3plus.javastreamplayer.stream.StreamPlayer;
10+
import main.java.goxr3plus.javastreamplayer.stream.StreamPlayerEvent;
11+
import main.java.goxr3plus.javastreamplayer.stream.StreamPlayerException;
12+
import main.java.goxr3plus.javastreamplayer.stream.StreamPlayerListener;
13+
14+
/**
15+
* @author GOXR3PLUS
16+
*
17+
*/
18+
public class Main extends StreamPlayer implements StreamPlayerListener {
19+
20+
private final String basePath = "C:\\Users\\GOXR3PLUSSTUDIO\\Desktop\\";
21+
private final String audioAbsolutePath = basePath + "DJ WhiteO - Break Hard [mixtape] .stance.mp3";
22+
23+
/**
24+
* Constructor
25+
*/
26+
public Main() {
27+
28+
try {
29+
30+
// Register to the Listeners
31+
addStreamPlayerListener(this);
32+
33+
// Open a File
34+
// open(new File("...")) //..Here must be the file absolute path
35+
// open(INPUTSTREAM)
36+
// open(AUDIOURL)
37+
38+
// Example
39+
open(new File(audioAbsolutePath));
40+
// Play it
41+
play();
42+
43+
} catch (final StreamPlayerException ex) {
44+
ex.printStackTrace();
45+
}
46+
47+
}
48+
49+
/*
50+
* (non-Javadoc)
51+
*
52+
* @see streamplayer.StreamPlayerListener#opened(java.lang.Object,
53+
* java.util.Map)
54+
*/
55+
@Override
56+
public void opened(final Object dataSource, final Map<String, Object> properties) {
57+
58+
}
59+
60+
/*
61+
* (non-Javadoc)
62+
*
63+
* @see streamplayer.StreamPlayerListener#progress(int, long, byte[],
64+
* java.util.Map)
65+
*/
66+
@Override
67+
public void progress(final int nEncodedBytes, final long microsecondPosition, final byte[] pcmData,
68+
final Map<String, Object> properties) {
69+
70+
System.out.println("Encoded Bytes : " + nEncodedBytes);
71+
72+
// Current time position in seconds:) by GOXR3PLUS STUDIO
73+
// This is not the more precise way ... in XR3Player i am using different
74+
// techniques .
75+
// Just for demostration purposes :)
76+
// I will add more advanced techniques with milliseconds , microseconds , hours
77+
// and minutes soon
78+
System.out.println("Current time is : " + (int) (microsecondPosition / 1000000) + " seconds");
79+
}
80+
81+
/*
82+
* (non-Javadoc)
83+
*
84+
* @see streamplayer.StreamPlayerListener#statusUpdated(streamplayer.
85+
* StreamPlayerEvent)
86+
*/
87+
@Override
88+
public void statusUpdated(final StreamPlayerEvent event) {
89+
System.out.println(event.getPlayerStatus());
90+
}
91+
92+
public static void main(final String[] args) {
93+
new Main();
94+
}
95+
96+
}

0 commit comments

Comments
 (0)