同步操作将从 Pear/PearDownloader.js 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
PearDownloader is a multi-source and multi-protocol P2P streaming downloader that works in the browser. It's easy to get started!
Simply include the
(pear-downloader.min.js
)
script on your page:
<script src="pear-downloader.min.js"></script>
To install PearPlayer for use in the browser with require('PearDownloader')
, run:
npm install peardownloader --save
Then you can require PearDownloader like this:
var PearDownloader = require('PearDownloader');
var PearDownloader = require('PearDownloader');
var downloader = new PearDownloader(url);
There is a complete example in examples/downloader-test.html。
var downloader = new PearDownloader(url, { //第一个参数为url
useMonitor: true //是否开启monitor,会稍微影响性能,默认false
});
downloader.on('exception', onException);
downloader.on('begin', onBegin);
downloader.on('progress', onProgress);
downloader.on('sourcemap', onSourceMap);
downloader.on('done', onDone);
function onBegin(fileLength, chunks) {
console.log('start downloading buffer by first aid, file length is:' + fileLength + ' total chunks:' + chunks);
}
function onProgress(downloaded) {
console.log('Progress: ' + (downloaded * 100).toFixed(1) + '%');
}
function onDone() {
console.log('finished downloading buffer by first aid');
}
function onException(exception) {
var errCode = exception.errCode;
switch (errCode) {
case 1: //当前浏览器不支持WebRTC
console.log(exception.errMsg);
break
}
}
function onSourceMap(sourceType, index) {
console.log('Received source type:' + sourceType + ' index:' + index);
}
PearDownloader works great with browserify, which lets
you use node.js style require()
to organize your browser
code, and load packages installed by npm.
npm install -g browserify
Install dependencies:
npm install
To get a normal size bundle,use:
npm run build-downloader
To get a compressed bundle,use:
npm run uglify-downloader
Check out the API Documentation and FAQ for more details.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。