twilio / twilio-video.js

Twilio’s Programmable Video JavaScript SDK
https://www.twilio.com/docs/video/javascript
Other
571 stars 217 forks source link

Sound file as a LocalAudioTrack plays in a distorted way #1874

Closed alicanerdogan closed 2 years ago

alicanerdogan commented 2 years ago

Code to reproduce the issue:

const soundFile = new Audio(`INSERT_AUDIO_FILE_URL`);
soundFile.crossOrigin = 'anonymous';

const audioContext = new AudioContext();
const audioSource = audioContext.createMediaElementSource(soundFile);
const audioDestination = audioContext.createMediaStreamDestination();
audioSource.connect(audioContext.destination);
audioSource.connect(audioDestination);
const track = audioDestination.stream.getAudioTracks()[0];
const twilioTrack = new LocalAudioTrack(track);
const publication = await twilioRoom.localParticipant.publishTrack(twilioTrack);

Expected behavior:

Sound file plays as usual.

Actual behavior:

Sound file plays in a distorted way. Time to time it sounds like an echo exists and there are high pitch noises.

Software versions:

manjeshbhargav commented 2 years ago

Hi @alicanerdogan ,

Thanks for reaching out. We will investigate and get back to you.

MaheshSinghSawant commented 2 years ago

Hi @alicanerdogan, we were not able to reproduce the issue. The sound file we tried played without any distortions, echo or high pitched voices. Did you perhaps have the two participants join on the same machine in two different tabs or have the devices close to each other?

manjeshbhargav commented 2 years ago

Closing due to inactivity.