rtcdatachannel

Android WebRTC DataChannel binary transfer mode

佐手、 提交于 2019-12-06 13:38:47
问题 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 :

Android WebRTC DataChannel binary transfer mode

懵懂的女人 提交于 2019-12-04 19:16:27
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 : public void onMessage( final DataChannel.Buffer buffer ){ Log.e(TAG, "Incomming file on DataChannel");

Working Hello World WebRTC DataChannel Examples with Signaling Implemented

让人想犯罪 __ 提交于 2019-12-03 07:16:32
The intent is for this to become a Community Wiki post that is kept up-to-date so developers interested in implementing communication of JSON messages browser-to-browser (p2p) with WebRTC DataChannels have simple yet functional examples. WebRTC DataChannels are experimental and still in draft. It seems that currently the web is a minefield of outdated WebRTC examples and even more so if a developer is trying to learn the RTCDataChannel API. Simple yet functional 1-page examples that work today across WebRTC compliant browsers seem very difficult to find. For example, some examples leave out a