From 61b20cfef1c3d143eace89caa1153584030ba657 Mon Sep 17 00:00:00 2001 From: toxic-johann <353904974@qq.com> Date: Fri, 28 Jul 2017 15:56:35 +0800 Subject: [PATCH] [update] add silent load demo what: why: how: --- demo/silentload/index.html | 4 +- demo/silentload/index.js | 87 +++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 46 deletions(-) diff --git a/demo/silentload/index.html b/demo/silentload/index.html index abf390e..311f70d 100644 --- a/demo/silentload/index.html +++ b/demo/silentload/index.html @@ -10,14 +10,12 @@
-

Simplest Demo

-

The simplest demo for Chimee with only one button

+

Silent Load

- \ No newline at end of file diff --git a/demo/silentload/index.js b/demo/silentload/index.js index c1bcc1b..471d051 100644 --- a/demo/silentload/index.js +++ b/demo/silentload/index.js @@ -1,43 +1,44 @@ -// const Chimee = window.Chimee; -// const nativeSwtich = { -// name: 'native-switch', -// // 插件实体为按钮 -// el: '', -// // 在插件创建的阶段,我们为插件绑定事件。 -// 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: '', + 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: '', + 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: '', + 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;