【问题标题】:Shouting/sending a Blob object does not work in webRTC喊/发送 Blob 对象在 webRTC 中不起作用
【发布时间】:2020-04-05 12:19:09
【问题描述】:

我正在使用这个React library 来喊一个 JS Blob 对象,但它没有看到发送 Blob。

如果我这样做是为了喊出 Blob 对象,我会在有效负载中得到一个空对象:

console.log('sending', blob); // sending Blob {size: 384, type: "audio/mp3"}
this.props.webrtc.shout('chat', blob);

收到喊叫的peer得到{}

但如果我要这样喊的话:

this.props.webrtc.shout('chat', 123);

然后接收者看到123

有人知道为什么吗?

【问题讨论】:

    标签: reactjs websocket webrtc blob


    【解决方案1】:

    Chrome/webrtc.org does not support sending blobs。您需要将其拆分为块并将它们作为数组缓冲区发送。 This sample 显示详情

    【讨论】:

    • 我尝试发送一个 arrayBuffer 但它也是一个空对象。 this.props.webrtc.shout('chat', arrayBuff); //发送 ArrayBuffer(6144) {}`
    • 但是,如果我发送该 blob 的二进制字符串,那么它会发送。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-10
    • 1970-01-01
    • 2019-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多