mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-04-29 14:59:50 +00:00
Update AudioStreamService.java
This commit is contained in:
parent
9f152dd3b0
commit
237fdbb0e1
1 changed files with 3 additions and 2 deletions
|
|
@ -66,8 +66,6 @@ public class AudioStreamService extends Service {
|
|||
AudioTrack.MODE_STREAM
|
||||
);
|
||||
|
||||
audioTrack.play();
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
LocalSocket socket = new LocalSocket();
|
||||
|
|
@ -82,6 +80,8 @@ public class AudioStreamService extends Service {
|
|||
while ((bytesRead = in.read(buffer)) != -1) {
|
||||
// If raw PCM data
|
||||
audioTrack.write(buffer, 0, bytesRead);
|
||||
if (audioTrack != null)
|
||||
audioTrack.play();
|
||||
}
|
||||
|
||||
in.close();
|
||||
|
|
@ -100,6 +100,7 @@ public class AudioStreamService extends Service {
|
|||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
isPlaying = false;
|
||||
assert audioTrack != null;
|
||||
audioTrack.stop();
|
||||
audioTrack.release();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue