fix airplay not working sometimes

This commit is contained in:
vapormusic 2022-05-15 13:47:35 +07:00
parent 8d9ac86514
commit ccae1098fc

View file

@ -296,6 +296,7 @@ const CiderAudio = {
if (this._isBufferFull()) { if (this._isBufferFull()) {
this._flush(); this._flush();
} }
try{
let dataLength = audioRawData[0].length; let dataLength = audioRawData[0].length;
for (let idx=0; idx<dataLength; idx++) { for (let idx=0; idx<dataLength; idx++) {
for (let channel=0; channel < numberOfChannels; channel++) { for (let channel=0; channel < numberOfChannels; channel++) {
@ -303,6 +304,8 @@ const CiderAudio = {
this._buffers[channel][this._bytesWritten] = value; this._buffers[channel][this._bytesWritten] = value;
} }
this._bytesWritten += 1; this._bytesWritten += 1;
}} catch (e){
// console.log(e)
} }
} }
@ -377,7 +380,7 @@ const CiderAudio = {
} }
} }
CiderAudio.audioNodes.recorderNode.parameters.get('isRecording').setValueAtTime(1, CiderAudio.context.currentTime); CiderAudio.audioNodes.recorderNode.parameters.get('isRecording').setValueAtTime(1, CiderAudio.context.currentTime);
CiderAudio.audioNodes.gainNode.connect(CiderAudio.audioNodes.recorderNode); CiderAudio.source.connect(CiderAudio.audioNodes.recorderNode);
}); });
clearInterval(searchInt); clearInterval(searchInt);