Android WebRTC DataChannel binary transfer mode
问题 I achieved to transfer data between two android phones using WebRTC's DataChannel : On one side, I send the data: boolean isBinaryFile = false; File file = new File(path); // let's assume path is a .whatever file's path (txt, jpg, pdf..) ByteBuffer byteBuffer = ByteBuffer.wrap(convertFileToByteArray(file)); DataChannel.Buffer buf = new DataChannel.Buffer(byteBuffer, isBinaryFile); dataChannel.send(buf); On the other side, this callback should be called regardless of isBinaryFile value :