资源简介
此demo程序实现了浏览器前端页面,信令服务器采用nodejs实现,可实现多人视频,代码中限制为5人。具体配置方法可参考我的blog《webrtc的DEMO环境搭建》
代码片段和文件信息
#!/usr/bin/env python
import re
import json
# http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
# http://stackoverflow.com/a/13436167/96656
def unisymbol(codePoint):
if codePoint >= 0x0000 and codePoint <= 0xFFFF:
return unichr(codePoint)
elif codePoint >= 0x010000 and codePoint <= 0x10FFFF:
highSurrogate = int((codePoint - 0x10000) / 0x400) + 0xD800
lowSurrogate = int((codePoint - 0x10000) % 0x400) + 0xDC00
return unichr(highSurrogate) + unichr(lowSurrogate)
else:
return ‘Error‘
def hexify(codePoint):
return ‘U+‘ + hex(codePoint)[2:].upper().zfill(6)
def writeFile(filename contents):
print filename
with open(filename ‘w‘) as f:
f.write(contents.strip() + ‘\n‘)
data = []
for codePoint in range(0x000000 0x10FFFF + 1):
symbol = unisymbol(codePoint)
# http://stackoverflow.com/a/17199950/96656
bytes = symbol.encode(‘utf8‘).decode(‘latin1‘)
data.append({
‘codePoint‘: codePoint
‘decoded‘: symbol
‘encoded‘: bytes
});
jsonData = json.dumps(data sort_keys=False indent=2 separators=(‘‘ ‘: ‘))
# Use tabs instead of double spaces for indentation
jsonData = jsonData.replace(‘ ‘ ‘\t‘)
# Escape hexadecimal digits in escape sequences
jsonData = re.sub(
r‘\\u([a-fA-F0-9]{4})‘
lambda match: r‘\u{}‘.format(match.group(1).upper())
jsonData
)
writeFile(‘data.json‘ jsonData)
相关资源
- excel完美转html在官方demo基础上优化,
- DapperExtensions.Demo
- 搜集的webGL的资料和自己做的一些De
- 百度地图3.0离线js api模板demo+ 地图瓦
- springboot整合pdfjs修改版简单demo可直接
- ios学习经典27个
- CAS集成demo
- threejs demo
- Web Echarts+layui 统计图表demo (统计深圳
- flv.js demo带视频可直接使用
- 可视化机器学习
- Signalr即时通讯.Net MVC Demo
- spring-boot加redis的秒传与分片上传dem
- html5-bluetooth-demo
- ActiveX控件加载外部dll及html测试Demo
- [好资源分享]-Delphi HTML解析 源码 dem
- tinymce富文本编辑器集成demo,添加po
-
ja
vasc ript解析二维码插件以及dem - html5 audio demo【修复拖动进度条bug】
- html5 audio demo
- zDialog弹出框-内附使用说明及demo
- Qunee for html5(demo)
- 微信小程序Demo:仿饿了吗
- 微信小程序Demo:事项助手在日历上添
- 微信小程序Demo:二十四节气小程序
- 微信小程序Demo:阅享小程序阅读评价
- HTML静态页实现微信分享Demo
- Html5像素超级玛丽简易版demo
- QT-电压电阻表盘源码可以自定义阴影
- LeafletDemo.rar
评论
共有 条评论