作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试实现一个网站,人们可以通过 html5 canvas 和 pubnub 进行绘图,并且每个人都可以看到其他人的绘图。到目前为止,一切都很好,唯一的问题是我希望人们能够上传图像,然后在它们上绘图(当然每个人都能够看到上传的图像)。
来自这篇文章here我上传了图像的一部分,但是当我上传图像时,其他用户不会发生这种情况。关于如何实现这一点有什么想法吗?
最佳答案
Get the PubNub WebRTC SDK - https://github.com/stephenlb/webrtc-sdk
您可以轻松地从视频流中拍摄照片并立即发送给您的 friend 。您可以将其视为 Instagram WebRTC 风格。照片共享也可以通过企业防火墙进行。
phone.snap()
Broadcast your camera photo to all connected sessions. Also get the IMG data as base64 supported format for local display if desired.
phone.ready(function(){
// Auto Send Camera's Photo to all connected Sessions.
var photo = phone.snap();
$('#photo-div').append(photo.image);
});
session.snap()
Send your camera's latest frame as raw IMG to a specific call session.
phone.ready(function(){
var session = phone.dial('4321');
var photo = session.snap();
$('#photo-div').append(photo.image);
});
关于javascript - 通过webrtc传递上传的图片 - pubnub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29490634/
我有以下正则表达式 /[a-zA-Z0-9_-]/ 当字符串只包含从 a 到z 大小写、数字、_ 和 -。 我的代码有什么问题? 能否请您向我提供一个简短的解释和有关如何修复它的代码示例? //var
我是一名优秀的程序员,十分优秀!