Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
pearplayer
Advanced tools
PearPlayer(梨享播放器)[Demo] 是完全用JavaScript写的开源HTML5流媒体播放框架,实现了融合HTTP(含HTTPS、HTTP2)和WebRTC的多协议、多源、低延迟、高带宽利用率的无插件Web客户端流媒体加速能力。基于H5的MSE(Media Source Extension)技术将来自多个源节点的Buffer分块喂给播放器,再加上精心设计的算法可实现最优的调度策略及对各种异常情况的处理,PearPlayer由此能在保证用户流畅视频体验的前提下最大化P2P率。
通过<script>
标签将pear-player.min.js
导入到HTML即可使用。参考以下代码示例,也可查看/examples/player-test.html
或get-started了解使用方法。
<video>
标签一样简单,并易与video.js等流行播放框架集成将以下代码拷贝到HTML5代码中,打开网页,见证奇迹的时刻到了!
<script src="https://cdn.jsdelivr.net/npm/pearplayer@latest"></script>
<video id="video" controls></video>
<script>
var player = new PearPlayer('#video', { src: 'https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4' });
</script>
首先通过script标签导入pear-player.min.js:
<script src="./dist/pear-player.min.js"></script>
或使用CDN:
<script src="https://cdn.jsdelivr.net/npm/pearplayer@latest"></script>
假设用video标签播放以下视频,HTML如下:
<video id="pearvideo" src="https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4" controls>
只需以下几行代码,即可将PearPlayer绑定到video标签:
<script>
/**
* 第一个参数为video标签的id或class
* opts是可选的参数配置
*/
if (PearPlayer.isMSESupported()) {
var player = new PearPlayer('#pearvideo', opts);
}
</script>
恭喜您,您的播放器已经具备P2P能力了,而且无须任何插件!
示例中的视频是已经分发过的,那么如何为任意视频加速呢?很简单,只需在视频分发系统中添加您的视频URL,即可利用Pear的海量节点为您的视频加速!具体教程请点击这里(目前新注册用户可以免费分发3个大小不超过100MB的MP4或TS格式的文件,视频名字需添加Pear-Demo
前缀,如Pear-Demo-movie.mp4
)
特别感谢以下项目,为本项目提供了部分灵感以及API设计参考:
2018.02.07
(36氪) - 「Pear梨享」让雾计算落地,百万边缘节点的背后是提高效率和成本控制2017.09.01
(未来网络开放社区联盟) - 继云计算之后,雾计算再起 —— 谈谈 P2P CDN2017.08.18
(IT大咖说) - WebRTC会成主流吗?众包CDN时代到了!2017.07.11
(OSChina开源中国) - PearPlayer.js —— 混合P2P-CDN的流媒体播放器2017.06.24
(腾讯Web前端大会) - 基于WebRTC的P2P-CDN流媒体加速2017.05.17
(南方科技大学) - Edge Computing and Shared Fog Streaming2017.05.08
(台湾逢甲大学) - A Cooler Fruit Venture: Scaling up a Network from Cloud to Fog with Crowdsourcing2016.08.17
(香港科技大学) - From Cloud to Fog: Scaling up a Network with CrowdsourcingMIT. Copyright (c) Pear Limited
E-mail: service@pear.hk;用户QQ群:373594967
;CP/CDN接入、OEM与其他商务合作
FAQs
PearPlayer.js
We found that pearplayer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.