Skip to content

Commit

Permalink
[update] add silent load demo
Browse files Browse the repository at this point in the history
what:
why:
how:
  • Loading branch information
toxic-johann committed Jul 28, 2017
1 parent bdcf00e commit 61b20cf
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 46 deletions.
4 changes: 1 addition & 3 deletions demo/silentload/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
</head>
<body>
<header>
<h1>Simplest Demo</h1>
<p>The simplest demo for Chimee with only one button</p>
<h1>Silent Load</h1>
</header>
<section id="wrapper"></section>
</body>
<script type="text/javascript" src="/lib/index.dev.js"></script>
<script type="text/javascript" src="/node_modules/chimee-kernel-flv/lib/index.browser.js"></script>
<script type="text/javascript" src="/node_modules/chimee-kernel-hls/lib/index.browser.js"></script>
<!--<script type="text/javascript" src="/lib/player.umd.js"></script>-->
<script type="text/javascript" src="./index.js"></script>
</html>
87 changes: 44 additions & 43 deletions demo/silentload/index.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
// const Chimee = window.Chimee;
// const nativeSwtich = {
// name: 'native-switch',
// // 插件实体为按钮
// el: '<button>native switch</button>',
// // 在插件创建的阶段,我们为插件绑定事件。
// create () {
// this.$dom.addEventListener('click', () => {
// this.
// });
// },
// // 插件会在播放暂停操作发生后改变自己的文案及相应的行为
// events: {
// pause () {
// this.changeButtonText('play');
// },
// play () {
// this.changeButtonText('pause');
// },
// c_contextmenu (evt) {
// console.log(evt);
// }
// }
// };
// Chimee.install(plugin);
// const player = new Chimee({
// // 播放地址
// src: 'http://cdn.toxicjohann.com/lostStar.mp4',
// // src: 'http://cdn.toxicjohann.com/%E4%BA%8E%E6%98%AF.mp4',
// // src: 'http://yunxianchang.live.ujne7.com/vod-system-bj/TL1ce1196bce348070bfeef2116efbdea6.flv',
// // src: 'http://yunxianchang.live.ujne7.com/vod-system-bj/79_3041054cc65-ae8c-4b63-8937-5ccb05f79720.m3u8',
// // dom容器
// wrapper: '#wrapper',
// plugin: ['controller'],
// preset: {
// flv: window.chimeeKernelFlv,
// hls: window.chimeeKernelHls
// },
// volume: 0.1,
// // autoplay: true,
// controls: true
// });
// window.player = player;
const Chimee = window.Chimee;
const nativeSwitch = {
name: 'native-switch',
el: '<button>native switch</button>',
create () {
this.$dom.addEventListener('click', () => {
this.$silentLoad('http://cdn.toxicjohann.com/%E4%BA%8E%E6%98%AF.mp4', {repeatTimes: 5, increment: 2});
});
}
};
const flvSwitch = {
name: 'flv-switch',
el: '<button>flv switch</button>',
create () {
this.$dom.addEventListener('click', () => {
this.$silentLoad('http://yunxianchang.live.ujne7.com/vod-system-bj/TL1ce1196bce348070bfeef2116efbdea6.flv', {repeatTimes: 5, increment: 2});
});
}
};
const hlsSwitch = {
name: 'hls-switch',
el: '<button>hls switch</button>',
create () {
this.$dom.addEventListener('click', () => {
this.$silentLoad('http://yunxianchang.live.ujne7.com/vod-system-bj/79_3041054cc65-ae8c-4b63-8937-5ccb05f79720.m3u8', {repeatTimes: 5, increment: 2});
});
}
};
Chimee.install(nativeSwitch);
Chimee.install(flvSwitch);
Chimee.install(hlsSwitch);
const player = new Chimee({
src: 'http://cdn.toxicjohann.com/lostStar.mp4',
wrapper: '#wrapper',
plugin: ['nativeSwitch', 'flvSwitch', 'hlsSwitch'],
preset: {
flv: window.chimeeKernelFlv,
hls: window.chimeeKernelHls
},
volume: 0.1,
autoplay: true,
controls: true
});
window.player = player;

0 comments on commit 61b20cf

Please sign in to comment.