├── .gitignore ├── README.md ├── Readme_zh.md ├── demo ├── dplayer.html ├── flowplayer.html ├── plyr.html ├── quick-start.html └── videojs.html └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | /node_modules 4 | /dist 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **English | [简体中文](Readme_zh.md)** 2 | 3 |

cdnbye logo

4 |

Let your viewers become your unlimitedly scalable CDN.

5 |

6 | npm 7 | jsdelivr 8 |

9 | 10 | 11 | CDNBye dashjs-p2p-engine implements [WebRTC](https://en.wikipedia.org/wiki/WebRTC) datachannel to scale live/vod video streaming by peer-to-peer network using bittorrent-like protocol. The forming peer network can be layed over other CDNs or on top of the origin server. Powered by [dash.js](https://github.com/Dash-Industry-Forum/dash.js), it can play MPEG-dash on PC and mobile. 12 | 13 | ## Features 14 | - WebRTC data channels for lightweight peer-to-peer communication with no plugins 15 | - Support live and VOD streams over MPEG-dash protocol 16 | - Very easy to integrate with an existing dash.js project 17 | - Seamlessly fallback to normal server usage if a browser doesn't support WebRTC 18 | - Compatible with all CDNs, agnostic to DRM and video codecs. No service side changes required. 19 | - Efficient scheduling policies to enhance the performance of P2P streaming 20 | - Use IP database to group up peers by ISP and regions 21 | 22 | ## Getting Started 23 | Put the [quick-start.html](demo/quick-start.html) in your web page, run it. Wait for a few seconds,then open the same page from another browser. Now you have a direct P2P connection between two browsers without plugin! 24 | The first web peer will serve as a seed, if no one else in the same channel. 25 | 26 | ## Browser Support 27 | WebRTC has already been incorporated into the HTML5 standard and it is broadly deployed in modern browsers. The compatibility of CDNBye depends on the browser support of WebRTC and dash.js. Please note that iOS Safari "Mobile" does not support the MediaSource API. 28 | 29 | Compatibility|Chrome | Firefox | macOS Safari| Android Wechat/QQ | Opera | Edge | IE | iOS Safari | 30 | :-: | :-: | :-: | :-: | :-: | :-: | :-:| :-:| :-: 31 | WebRTC Datachannel | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | 32 | dash.js | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | 33 | CDNBye | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | 34 | 35 | ## Include 36 | Include the pre-built script of latest version: 37 | ```html 38 | 39 | ``` 40 | 41 | ## API and Configuration 42 | See [API.md](https://docs.swarmcloud.net/dashjs/API) 43 | 44 | ## Console 45 | Register your domain in [dashboard](https://dash.swarmcloud.net), where you can view p2p-related information. 46 | 47 | ## Related Projects 48 | - [shaka-p2p-engine](https://github.com/cdnbye/shaka-p2p-engine) - P2P engine for Shaka Player. 49 | - [hlsjs-p2p-engine](https://github.com/cdnbye/hlsjs-p2p-engine) - Web Video Delivery Technology with No Plugins for hls.js. 50 | - [mp4-p2p-engine](https://github.com/cdnbye/mp4-p2p-engine) - Web Video Delivery Technology with No Plugins for MP4. 51 | 52 | ## FAQ 53 | We have collected some [frequently asked questions](https://docs.swarmcloud.net/faq). Before reporting an issue, please search if the FAQ has the answer to your problem. 54 | 55 | ## Contact Us 56 | Email: service@cdnbye.com 57 |
58 | Telegram: @cdnbye 59 |
60 | Skype: live:86755838 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Readme_zh.md: -------------------------------------------------------------------------------- 1 | **[English](README.md) | 简体中文** 2 | 3 |

cdnbye logo

4 |

Save Your Bandwidth using WebRTC.

5 |

视频网站省流量&加速插件.

6 |

7 | npm 8 | jsdelivr 9 |

10 | 11 | P2P技术使观看相同内容的用户之间可以相互分享数据,不仅能效降低视频/直播网站的带宽成本,还可以提升用户的播放体验,降低卡顿、二次缓存的发生率。 12 | 另外,随着H5的普及,flash逐渐被淘汰已成为不可逆转的趋势。而在H5采用的视频传输格式中,dash由于兼容ios和android、可以穿过任何允许HTTP数据通过的防火墙、容易使用内容分发网络来传输媒体流和码率自适应等众多优势而在业界得到广泛使用。通过使用[dash.js](https://github.com/Dash-Industry-Forum/dash.js)这个第三方库,几乎所有现代浏览器都可以播放dash视频。dash天生分片传输的优势,使其可以采用p2p的方式进行传输,从而减小服务器的负担。在web端,无插件化实现p2p传输能力的最好选择就是[WebRTC](https://zh.wikipedia.org/wiki/WebRTC)技术,与dash.js类似,WebRTC也支持几乎所有现代浏览器。本项目是一个dash.js的插件,通过WebRTC datachannel技术,在不影响用户体验的前提下,最大化p2p率,是面向未来的Web P2P技术。 13 | 14 | 该插件的优势如下: 15 | - 浏览器原生支持,不需要安装任何插件,采用仿BT算法,在线人数越多效果越好 16 | - 支持基于MPEG-dash流媒体协议的直播和点播场景 17 | - 不改动dash.js源码,并且可以与其无缝衔接,几行代码集成,便于在现有项目中快速集成 18 | - 浏览器不支持WebRTC时无缝切换到HTTP下载模式 19 | - 高可配置化,用户可以根据特定的使用环境调整各个参数 20 | - 通过有效的调度策略来保证用户的播放体验以及p2p率 21 | - Tracker服务器根据访问IP的ISP、地域等进行智能调度 22 | 23 | ## 快速入门 24 | 将[quick-start.html](demo/quick-start.html)拷贝到您的网页中并运行。再打开另一个相同的网页。见证奇迹的时候到了!您已在两个网页之间建立了一个P2P连接,在不安装任何插件的情况下。如果在这个频道中(一个mpd标识了一个频道)没有其它参与者,那么您打开的第一个网页将作为种子为第二个网页提供数据。 25 | 26 | ## 浏览器支持情况 27 | 由于WebRTC已成为HTML5标准,目前大部分主流浏览器都已经支持。CDNBye的浏览器兼容性取决于WebRTC和dash.js。需要注意的是iOS版Safari由于不支持MediaSource API,因此也不支持dash.js。 28 | 29 | 兼容性|Chrome | Firefox | macOS Safari| 安卓微信/QQ | Opera | Edge | IE | iOS Safari | 30 | :-: | :-: | :-: | :-: | :-: | :-: | :-:| :-:| :-: 31 | WebRTC Datachannel | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | 32 | dash.js | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | 33 | CDNBye | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | 34 | 35 | ## 集成 36 | 通过script标签引入最新版本: 37 | ```html 38 | 39 | ``` 40 | 41 | ## API文档 42 | 参见 [API.md](https://www.cdnbye.com/cn/dashjs/API.html) 43 | 44 | ## 后台管理系统 45 | 在接入P2P插件后,访问[dashboard](https://dash.swarmcloud.net),注册并绑定域名,即可查看该域名的P2P流量、在线人数、用户地理分布等信息。 46 | 47 | ## 相关项目 48 | - [shaka-p2p-engine](https://github.com/cdnbye/shaka-p2p-engine) - 同时支持HLS和Mpeg-Dash格式。 49 | - [hlsjs-p2p-engine](https://gitee.com/cdnbye/hlsjs-p2p-engine) - HLS协议的Web端P2P流媒体方案。 50 | - [mp4-p2p-engine](https://github.com/cdnbye/mp4-p2p-engine) - 支持MP4的Web端P2P流媒体方案。 51 | 52 | ## FAQ 53 | 我们收集了一些[常见问题](https://www.cdnbye.com/faq.html)。在报告issue之前请先查看一下。 54 | 55 | ## 联系我们 56 | 邮箱:service@cdnbye.com 57 | 58 | -------------------------------------------------------------------------------- /demo/dplayer.html: -------------------------------------------------------------------------------- 1 | 2 | 8 |
9 |
10 | 11 | 12 | 13 | 57 | -------------------------------------------------------------------------------- /demo/flowplayer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |

12 |

download info:

13 |

14 | 33 | -------------------------------------------------------------------------------- /demo/plyr.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

download info:

5 |

6 | 7 | 8 | 9 | 10 | 16 | 49 | -------------------------------------------------------------------------------- /demo/quick-start.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 |

download info:

5 |

6 |

7 | 8 | 9 | 29 | 30 | -------------------------------------------------------------------------------- /demo/videojs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 37 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cdnbye-dash", 3 | "version": "0.7.5", 4 | "description": "Let your viewers become your unlimitedly scalable CDN.", 5 | "main": "./dist/dashjs-p2p-engine.min.js", 6 | "types": "./dist/dashjs-p2p-engine.min.d.ts", 7 | "files": [ 8 | "dist" 9 | ], 10 | "scripts": { 11 | "git-push": "git add demo && git add package.json && git add README.md && git add Readme_zh.md && git commit -m 'release v0.7.5' && git push origin master", 12 | "git-pull": "git pull origin master", 13 | "publish": "npm publish", 14 | "test": "echo \"Error: no test specified\" && exit 1" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/cdnbye/dashjs-p2p-engine" 19 | }, 20 | "author": "cdnbye", 21 | "license": "ISC", 22 | "keywords": [ 23 | "html5", 24 | "WebRTC", 25 | "video", 26 | "mse", 27 | "player", 28 | "p2p", 29 | "peer-to-peer", 30 | "dash", 31 | "dashjs", 32 | "cdnbye", 33 | "bittorrent", 34 | "webrtc data channel", 35 | "MPEG-dash" 36 | ] 37 | } 38 | --------------------------------------------------------------------------------