Skip to content

Commit

Permalink
[update] update doc for load
Browse files Browse the repository at this point in the history
  • Loading branch information
toxic-johann committed Dec 12, 2017
1 parent 9f8c69c commit 418d90c
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion doc/zh-cn/chimee-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ const player = new Chimee({
flv: {
handler: Flv,
stashSize: 1000 * 1000 * 1024,
},
},
// 编解码容器
box: 'flv', // flv hls mp4
Expand Down Expand Up @@ -330,6 +329,49 @@ chimee.load('http://yunxianchang.live.ujne7.com/vod-system-bj/TL1ce1196bce348070
})
```
load 在 v0.7.1 后支持更简便的写法。
```javascript
import Chimee from 'chimee';
import ChimeeKernelFlv from 'chimee-kernel-flv';
const chimee = new Chimee({
wrapper: '#wrapper',
src:'http://cdn.toxicjohann.com/lostStar.mp4',
autoplay: true
});
...
chimee.load({
src: 'http://yunxianchang.live.ujne7.com/vod-system-bj/TL1ce1196bce348070bfeef2116efbdea6.flv',
box: 'flv',
kernels: {
flv: ChimeeKernelFlv
}
})
```
同样的,因为我们传入的是 kernels ,所以我们也可以定义一些 kernels 的参数。
```javascript
import Chimee from 'chimee';
import ChimeeKernelFlv from 'chimee-kernel-flv';
const chimee = new Chimee({
wrapper: '#wrapper',
src:'http://cdn.toxicjohann.com/lostStar.mp4',
autoplay: true
});
...
chimee.load({
src: 'http://yunxianchang.live.ujne7.com/vod-system-bj/TL1ce1196bce348070bfeef2116efbdea6.flv',
box: 'flv',
kernels: {
flv: {
handler: ChimeeKernelFlv,
stashSize: 1000 * 1000 * 1024,
},
}
})
```
> load 方法会触发 load 系列事件,你可以通过插件 `beforeLoad` 阻截或挂起事件,也可以通过`load`事件阻止冒泡等。要了解更多相关知识,可以阅读[插件的事件机制](https://github.com/Chimeejs/chimee/blob/master/doc/zh-cn/plugin-api.md#%E4%BA%8B%E4%BB%B6%E6%9C%BA%E5%88%B6)。
> load 会在以下情况切换内部 kernel。
Expand Down

0 comments on commit 418d90c

Please sign in to comment.