I am working on Android VoIP Application
which uses Twilio Video Conference API.
Issue:
How to send custom audio bytes
recorded from AudioRecord to PSTN ?
I have already tried one of the example given in Video-Quickstart-Android i.e. ExampleAudioSink.
I am able to send and receive the bytes that are recorded and played by the WebRtcAudioRecord.
What I want is to send my own Custom recorded bytes in realtime via LocalAudioTrack. I have also bypassed the webrtcAudioPlay but can't seem to figure out, how to send my own bytes via LocalAudioTrack.
Here is twilio given workaround;
private void connectToRoom(String roomName) {
ConnectOptions.Builder connectOptionsBuilder = new ConnectOptions.Builder(accessToken)
.roomName(roomName);
if (localAudioTrack != null) {
connectOptionsBuilder
.audioTracks(Collections.singletonList(localAudioTrack));
}
room = Video.connect(this, connectOptionsBuilder.build(), roomListener());
}
private void createAudioTrack() {
localAudioTrack = LocalAudioTrack.create(this, false, LOCAL_AUDIO_TRACK_NAME);
}
Here you can see, I have stopped the sending of WebRtcAudioRecord bytes to PSTN by placing false in the second param of LocalAudioTrack.create, but couldn't figure it out how to send my own Data.
- Note: Please don't suggest me to send my bytes using LocalDataTrack API because LocalDataTrack API is not maintained yet to send bytes to PSTN.
For reference: video-quickstart-android