@aether-stack-dev/client-sdk 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +10 -2
- package/dist/index.js +10 -2
- package/dist/react.esm.js +10 -2
- package/dist/react.js +10 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -92,6 +92,10 @@ class AudioPlayer extends EventEmitter {
|
|
|
92
92
|
try {
|
|
93
93
|
const ctx = await this.ensureAudioContext();
|
|
94
94
|
const int16Array = new Int16Array(chunk.audio);
|
|
95
|
+
if (int16Array.length === 0) {
|
|
96
|
+
this.playNext();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
95
99
|
const floatArray = new Float32Array(int16Array.length);
|
|
96
100
|
for (let i = 0; i < int16Array.length; i++) {
|
|
97
101
|
floatArray[i] = int16Array[i] / 32768.0;
|
|
@@ -108,15 +112,19 @@ class AudioPlayer extends EventEmitter {
|
|
|
108
112
|
const duration = audioBuffer.duration;
|
|
109
113
|
const audioStartTime = ctx.currentTime;
|
|
110
114
|
let frameIndex = 0;
|
|
115
|
+
const wasPlaying = this.isPlaying;
|
|
111
116
|
this.isPlaying = true;
|
|
112
|
-
|
|
117
|
+
if (!wasPlaying)
|
|
118
|
+
this.emit('playbackStarted');
|
|
113
119
|
source.onended = () => {
|
|
114
120
|
if (this.animationFrameId !== null) {
|
|
115
121
|
cancelAnimationFrame(this.animationFrameId);
|
|
116
122
|
this.animationFrameId = null;
|
|
117
123
|
}
|
|
118
124
|
this.emit('blendshapeUpdate', new Array(BLENDSHAPE_COUNT).fill(0));
|
|
119
|
-
this.
|
|
125
|
+
if (this.audioQueue.length === 0) {
|
|
126
|
+
this.emit('playbackEnded');
|
|
127
|
+
}
|
|
120
128
|
this.playNext();
|
|
121
129
|
};
|
|
122
130
|
const animate = () => {
|
package/dist/index.js
CHANGED
|
@@ -96,6 +96,10 @@ class AudioPlayer extends eventemitter3.EventEmitter {
|
|
|
96
96
|
try {
|
|
97
97
|
const ctx = await this.ensureAudioContext();
|
|
98
98
|
const int16Array = new Int16Array(chunk.audio);
|
|
99
|
+
if (int16Array.length === 0) {
|
|
100
|
+
this.playNext();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
99
103
|
const floatArray = new Float32Array(int16Array.length);
|
|
100
104
|
for (let i = 0; i < int16Array.length; i++) {
|
|
101
105
|
floatArray[i] = int16Array[i] / 32768.0;
|
|
@@ -112,15 +116,19 @@ class AudioPlayer extends eventemitter3.EventEmitter {
|
|
|
112
116
|
const duration = audioBuffer.duration;
|
|
113
117
|
const audioStartTime = ctx.currentTime;
|
|
114
118
|
let frameIndex = 0;
|
|
119
|
+
const wasPlaying = this.isPlaying;
|
|
115
120
|
this.isPlaying = true;
|
|
116
|
-
|
|
121
|
+
if (!wasPlaying)
|
|
122
|
+
this.emit('playbackStarted');
|
|
117
123
|
source.onended = () => {
|
|
118
124
|
if (this.animationFrameId !== null) {
|
|
119
125
|
cancelAnimationFrame(this.animationFrameId);
|
|
120
126
|
this.animationFrameId = null;
|
|
121
127
|
}
|
|
122
128
|
this.emit('blendshapeUpdate', new Array(BLENDSHAPE_COUNT).fill(0));
|
|
123
|
-
this.
|
|
129
|
+
if (this.audioQueue.length === 0) {
|
|
130
|
+
this.emit('playbackEnded');
|
|
131
|
+
}
|
|
124
132
|
this.playNext();
|
|
125
133
|
};
|
|
126
134
|
const animate = () => {
|
package/dist/react.esm.js
CHANGED
|
@@ -98,6 +98,10 @@ class AudioPlayer extends EventEmitter {
|
|
|
98
98
|
try {
|
|
99
99
|
const ctx = await this.ensureAudioContext();
|
|
100
100
|
const int16Array = new Int16Array(chunk.audio);
|
|
101
|
+
if (int16Array.length === 0) {
|
|
102
|
+
this.playNext();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
101
105
|
const floatArray = new Float32Array(int16Array.length);
|
|
102
106
|
for (let i = 0; i < int16Array.length; i++) {
|
|
103
107
|
floatArray[i] = int16Array[i] / 32768.0;
|
|
@@ -114,15 +118,19 @@ class AudioPlayer extends EventEmitter {
|
|
|
114
118
|
const duration = audioBuffer.duration;
|
|
115
119
|
const audioStartTime = ctx.currentTime;
|
|
116
120
|
let frameIndex = 0;
|
|
121
|
+
const wasPlaying = this.isPlaying;
|
|
117
122
|
this.isPlaying = true;
|
|
118
|
-
|
|
123
|
+
if (!wasPlaying)
|
|
124
|
+
this.emit('playbackStarted');
|
|
119
125
|
source.onended = () => {
|
|
120
126
|
if (this.animationFrameId !== null) {
|
|
121
127
|
cancelAnimationFrame(this.animationFrameId);
|
|
122
128
|
this.animationFrameId = null;
|
|
123
129
|
}
|
|
124
130
|
this.emit('blendshapeUpdate', new Array(BLENDSHAPE_COUNT).fill(0));
|
|
125
|
-
this.
|
|
131
|
+
if (this.audioQueue.length === 0) {
|
|
132
|
+
this.emit('playbackEnded');
|
|
133
|
+
}
|
|
126
134
|
this.playNext();
|
|
127
135
|
};
|
|
128
136
|
const animate = () => {
|
package/dist/react.js
CHANGED
|
@@ -119,6 +119,10 @@ class AudioPlayer extends eventemitter3.EventEmitter {
|
|
|
119
119
|
try {
|
|
120
120
|
const ctx = await this.ensureAudioContext();
|
|
121
121
|
const int16Array = new Int16Array(chunk.audio);
|
|
122
|
+
if (int16Array.length === 0) {
|
|
123
|
+
this.playNext();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
122
126
|
const floatArray = new Float32Array(int16Array.length);
|
|
123
127
|
for (let i = 0; i < int16Array.length; i++) {
|
|
124
128
|
floatArray[i] = int16Array[i] / 32768.0;
|
|
@@ -135,15 +139,19 @@ class AudioPlayer extends eventemitter3.EventEmitter {
|
|
|
135
139
|
const duration = audioBuffer.duration;
|
|
136
140
|
const audioStartTime = ctx.currentTime;
|
|
137
141
|
let frameIndex = 0;
|
|
142
|
+
const wasPlaying = this.isPlaying;
|
|
138
143
|
this.isPlaying = true;
|
|
139
|
-
|
|
144
|
+
if (!wasPlaying)
|
|
145
|
+
this.emit('playbackStarted');
|
|
140
146
|
source.onended = () => {
|
|
141
147
|
if (this.animationFrameId !== null) {
|
|
142
148
|
cancelAnimationFrame(this.animationFrameId);
|
|
143
149
|
this.animationFrameId = null;
|
|
144
150
|
}
|
|
145
151
|
this.emit('blendshapeUpdate', new Array(BLENDSHAPE_COUNT).fill(0));
|
|
146
|
-
this.
|
|
152
|
+
if (this.audioQueue.length === 0) {
|
|
153
|
+
this.emit('playbackEnded');
|
|
154
|
+
}
|
|
147
155
|
this.playNext();
|
|
148
156
|
};
|
|
149
157
|
const animate = () => {
|