Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filetransfer example doesn't call onbufferedamountlow #1669

Open
sysescool opened this issue Jul 16, 2024 · 3 comments
Open

filetransfer example doesn't call onbufferedamountlow #1669

sysescool opened this issue Jul 16, 2024 · 3 comments

Comments

@sysescool
Copy link

sysescool commented Jul 16, 2024

Please read first!

Please use discuss-webrtc for general technical discussions and questions.
If you have found an issue/bug with the native libwebrtc SDK or a browser's behaviour around WebRTC please create an issue in the relevant bug tracker. You can find more information on how to submit a bug and do so in the right place here

  • [*] I understand that issues created here are only relevant to the samples in this repo - not browser or SDK bugs
  • [*] I have provided steps to reproduce
  • [*] I have provided browser name and version
  • [*] I have provided a link to the sample here or a modified version thereof

Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed.

Browser affected

One Side: Chrome Version 119.0.6045.159 (Official Build) (64-bit)
Another Side: Edge Version 126.0.2592.87 (Official Build) (64-bit)

Description

The file transfer example code is below:
https://github.com/webrtc/samples/blob/gh-pages/src/content/datachannel/filetransfer/js/main.js
However, it only run on the local, send file from local to local by DataChannel.

Steps to reproduce

Make a Signal server, and a STUN/TURN server.
Use the code about this file transfer example but to real peer-to-peer connection through Internet.
send a large file(e.g. 300M).

Expected results

I notice that: https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/bufferedamountlow_event
we could add call onbufferedamountlow to this example, so that the developers will understand and quickly apply it.
And developers will not see below error.

Actual results

You will see the error in the Console:

Uncaught DOMException: Failed to execute 'send' on 'RTCDataChannel': RTCDataChannel send queue is full
    at RTCDataChannel.send (https://webrtc.github.io/adapter/adapter-latest.js:1244:34)
    at fileReader.onload (https://xxxxxx/js/main.js:168:6)
        send                  @adapter-latest.js:1244
        fileReader.onload     @main.js:168
        load(异步)
        sendData              @main.js:166
        sendfile              @main.js:140

Assign

Please assign me.
I am working with webrtc recently and handling this error.

@sysescool
Copy link
Author

another question:
If the file is huge, how is it added to the receiveBuffer?

@fippo
Copy link
Collaborator

fippo commented Jul 24, 2024

#872 mentions this but was closed for no good reason. I wonder if the strategy from
https://github.com/otalk/filetransfer/blob/master/filetransfer.js#L28
still works but it has been eight years...

@sysescool
Copy link
Author

#872 mentions this but was closed for no good reason. I wonder if the strategy from https://github.com/otalk/filetransfer/blob/master/filetransfer.js#L28 still works but it has been eight years...

I don't know why ErikHellman said: "Also ,there seems to be some problems with that event at the moment. " in this link #872. And what exactly is the problem ErikHellman is talking about?

However, in reality, if you do not utilize this event in a practical scenario, the mentioned error will be triggered once the buffer queue is full and you proceed with the transmission.

I'm not particularly familiar with javascript, and my implementation is slightly different from yours. You should test whether it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants