剑痴乎

剑痴乎
代码为剑,如痴如醉
  1. 首页
  2. 编程之美
  3. 正文

WebRTC jQuery 插件

2013年10月11日 1633点热度 3人点赞 0条评论

该插件能使两个浏览器间实现实时的音视频流传输。

安装

·下载并解压代码包
·把解压后代码放到你的网站目录下
·打开你的网站
·欣赏代码所呈现的应用

使用

首先把如下HTML代码片段加入到你的相应标签内

1
2
3
4
5
6
7
8
9
10
11
12
13
<!-- main container -->
<div id="mainContainer" class="main-container">
 
    <!-- local video -->
    <video id="localVideo" class="local-video"></video>
 
    <!-- remote video -->
    <video id="remoteVideo" class="remote-video" autoplay></video>
 
    <!-- video status & room entry bar -->
    <div id="videoStatus" class="video-status"></div>
 
</div>

然后把如下CSS放到head标签内

1
<link rel="stylesheet" href="css/fts-webrtc-styles.css">

最后是通过JavaScript实现。代码如下:

1
2
3
4
5
6
7
8
9
10
<!-- JavaScript Ressources -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/jquery.fresh-tilled-soil-webrtc.js"></script>
 
<!-- Plugin Initialization -->
<script type="text/javascript">
    $(function() {
        $('#mainContainer').createVideoChat();
    });
</script>

完整的示例页面如下(把上述的放在一起):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Fresh Tilled Soil Video Conference | WebRTC jQuery Plug-in Demo</title>
 
<!-- Stylesheet Resources -->
<link rel="stylesheet" href="css/fts-webrtc-styles.css">
 
</head>
<body>
 
<!-- main container -->
<div id="mainContainer" class="main-container">
 
    <!-- local video -->
    <video id="localVideo" class="local-video"></video>
 
    <!-- remote video -->
    <video id="remoteVideo" class="remote-video" autoplay></video>
 
    <!-- video status & room entry bar -->
    <div id="videoStatus" class="video-status"></div>
 
</div>
 
<!-- JavaScript Ressources -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/jquery.fresh-tilled-soil-webrtc.js"></script>
 
<!-- Plugin Initialization -->
<script type="text/javascript">
    $(function() {
        $('#mainContainer').createVideoChat();
    });
</script>
 
</body>
</html>

浏览器支持情况

被赋予WebRtc新颖特性的JQuery插件已经支持主流的浏览器,这些浏览器支持最近起草的WebRtc标准,如下列表列出了最近支持该标准的浏览器:
Chrome
Chrome Beta for Android (for tablet & mobile phone support)
FireFox
Internet Explorer 10 (requires Google Chrome Frame plug-in)
Chromium
Chrome Canary
FireFox Aurora
FireFox Nightly

代码下载地址:webrtc-jquery-plugin-master

示例页面:基于WebRTC的简单在线视频聊天系统

本作品采用 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议 进行许可
标签: 暂无
最后更新:2017年10月19日

Jeff

管理员——代码为剑,如痴如醉

打赏 点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理。

版权声明

为支持原创,创作更好的文章,未经许可,禁止任何形式的转载与抄袭,如需转载请邮件私信!本人保留所有法定权利。违者必究!

最近评论
ztt 发布于 3 周前(04月05日) 你好,想看里面的视频和图片为什么没有显示呢?需要下flash吗还是什么。
huowa222 发布于 4 周前(03月26日) 同问
邱国禄 发布于 2 个月前(02月17日) Receive Delta以0.25ms为单位,reference time以64ms为单位,kDe...
啊非 发布于 4 个月前(12月30日) 大神,请教一个问题: constexpr int kBaseScaleFactor = Tran...
啊非 发布于 4 个月前(12月30日) reference time:3字节,表示参考时间,以64ms为单位,但是 代码里面是 Trans...
相关文章
  • Google ProtoBuf协议介绍
  • Intel Media SDK 内存优化(转)
  • 网络字节转换到本地字节的函数模板
  • 解决Ubuntu下vlc无法播放文件
  • MFC WebBrowser控件如何实现滚动条滑动

COPYRIGHT © 2024 jianchihu.net. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang