Skip to content

Commit

Permalink
Fix markdown tabs ( 4 => 2 )
Browse files Browse the repository at this point in the history
  • Loading branch information
damonqin committed Nov 29, 2017
1 parent e63eadd commit 1469d42
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1 align="center">
 <img src="fig/pear.png" height="220"></img>
 <img src="fig/pear.png" height="110"></img>
<br>
<a href="https://demo.webrtc.win/pearplayer">PearPlayer.js</a>
<br>
Expand Down Expand Up @@ -42,9 +42,7 @@ PearPlayer(梨享播放器)**[[Demo](https://demo.webrtc.win/pearplayer)]**
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<video id="video" controls></video>
<script>
var player = new PearPlayer('#video', {
src: 'https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4'
});
var player = new PearPlayer('#video', { src: 'https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4' });
</script>
```

Expand All @@ -66,13 +64,13 @@ PearPlayer(梨享播放器)**[[Demo](https://demo.webrtc.win/pearplayer)]**
只需要如下几行代码,即可将PearPlayer绑定到video标签:
```html
<script>
/**
* 第一个参数为video标签的id或class
* opts是可选的参数配置
*/
if (PearPlayer.isMSESupported()) {
var player = new PearPlayer('#pearvideo', opts);
}
/**
* 第一个参数为video标签的id或class
* opts是可选的参数配置
*/
if (PearPlayer.isMSESupported()) {
var player = new PearPlayer('#pearvideo', opts);
}
</script>
```
恭喜您,您的播放器已经具备P2P能力了,而且无须任何插件!
Expand Down
39 changes: 21 additions & 18 deletions docs/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,43 @@ There is a complete example in [examples/test.html](examples/test.html)。
### Listen to PearPlayer events

```js
var player = new PearPlayer('#pearvideo', { //第一个参数为video标签的id或class
type: 'mp4', //播放视频的类型,目前只能是mp4
src: 'https://qq.webrtc.win/tv/pear001.mp4', //视频播放的src
useMonitor: true //是否开启monitor,会稍微影响性能,默认false
});
var player = new PearPlayer('#pearvideo', {
//第一个参数为video标签的id或class
type: 'mp4', //播放视频的类型,目前只能是mp4
src: 'https://qq.webrtc.win/tv/pear001.mp4', //视频播放的src
useMonitor: true //是否开启monitor,会稍微影响性能,默认false
});

player.on('exception', onException);
player.on('begin', onBegin);
player.on('progress', onProgress);
player.on('buffersources', onBufferSources); //s: server n: node d: data channel b: browser
player.on('buffersources', onBufferSources); //s: server n: node d: data channel b: browser
player.on('done', onDone);

function onBegin(fileLength, chunks) {
console.log('start downloading buffer by first aid, file length is:' + fileLength + ' total chunks:' + 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) + '%');
console.log('Progress: ' + (downloaded * 100).toFixed(1) + '%');
}

function onDone() {
console.log('finished downloading buffer by first aid');
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
}
var errCode = exception.errCode;
switch (errCode) {
case 1:
//当前浏览器不支持WebRTC
console.log(exception.errMsg);
break;
}
}
function onBufferSources(bufferSources) { //s: server n: node d: data channel b: browser
console.log('Current Buffer Sources:' + bufferSources);
function onBufferSources(bufferSources) {
//s: server n: node d: data channel b: browser
console.log('Current Buffer Sources:' + bufferSources);
}
```

Expand Down

0 comments on commit 1469d42

Please sign in to comment.