- Notifications
You must be signed in to change notification settings - Fork201
a video player framework aims to bring wonderful experience on browser
License
Chimeejs/chimee
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
English |中文
Chimee is a web video player created by the Qiwoo Team. It's based on the web video element. It supports multiple media streams, including mp4, m3u8, flv, etc.
In most situations, we need to support complex functions based on video, such as many videos or advertising. It's hard to maintain them if you we just write it based on the video element. So we may need to have an iframe to sort out the logic and handle the communication. So Chimee offers a plugin system, so that anyone can split your complex functions into multiple plugins. Through this method of development, developers can decouple logic to achieve a quicker, gray-scale release and implement many other functions with relative ease.
Chimee helps developer to reach complex video capabilities from scratch easier and quicker.
Chimee is aweb video player.
- It supports multiple video stream including mp4, m3u8, flv, and more.
- It solves most of the compatibility problems including cross-browser fullscreen, autoplay, and playing inline.
What's more, it's also acomponent framework based on the video element.
- It helps us to split complex functions off into multiple plugins.
- Each plugin can work on the video element directly and easily.
- This framework sorts out the hierarchical relationship between plugins, which will keep us free from the
z-index
problem. - It provides a variety of modules such as a transparent plugin, a penetrating plugin, an inner plugin, and an outer plugin, which will cover most of the interactive scenarios.
- It offers us convenient ways to communicate between plugins.
- It allows us to define plugin priority, which has been useful in making the advertising plugin work as expected.
- It also supports asynchronous plugins.
npm install --save chimee
You can get the cdn url onhttps://cdnjs.com/libraries/chimee.
If you are in china, you can get the cdn url onhttps://www.jsdelivr.com/package/npm/chimee.
You can use Chimee directly.
Assuming you have adiv
whose id iswrapper
:
<body><divid="wrapper"></div></body>
You can then setup Chimee on it:
importChimeefrom'chimee';constchimee=newChimee('#wrapper');chimee.on('play',()=>console.log('play!!'));chimee.load('http://cdn.toxicjohann.com/lostStar.mp4');chimee.play();// play!!
Sometimes we need more customization; Chimee can be called by passing in an object:
importChimeefrom'chimee';constchimee=newChimee({wrapper:'#wrapper',src:'http://cdn.toxicjohann.com/lostStar.mp4',controls:true,autoplay:true,});
If you need to play video in flv or hls, you can simply add those kernels:
importChimeefrom'chimee';importflvfrom'chimee-kernel-flv';importhlsfrom'chimee-kernel-hls';constchimee=newChimee({wrapper:'#wrapper',src:'http://cdn.toxicjohann.com/lostStar.mp4',controls:true,autoplay:true,kernels:{ flv, hls}});chimee.play();
Or you can tryinstallKernel
, and then use it:
importChimeefrom'chimee';importflvfrom'chimee-kernel-flv';importhlsfrom'chimee-kernel-hls';Chimee.installKernel(flv);Chimee.installKernel(hls);constchimee=newChimee({wrapper:'#wrapper',src:'http://cdn.toxicjohann.com/lostStar.mp4',controls:true,autoplay:true,kernels:['flv','hls'],});chimee.play();
If you want to know more about Chimee, please read more on our API docs,here.
However, if you use Chimee directly, it's best to add this style to your page:
container {position: relative;display: block;width:100%;height:100%;}video {width:100%;height:100%;display: block;background-color:#000;}video:focus,video:active {outline: none;}
Chimee will simply use the default styles of browsers if you do not use any plugins. But you may want to try our UI plugin…
importpopupfrom'chimee-plugin-popup';importChimeefrom'chimee';Chimee.install(popup);constchimee=newChimee({wrapper:'#wrapper',src:'http://cdn.toxicjohann.com/lostStar.mp4',plugin:[popup.name],controls:false,autoplay:true});
If you want to know more about Chimee's plugins, please read morehere.
If you don't want more capabilities, and just need a useful video player, you can installchimee-player
, which contains the base ui and a loggerL
importChimeePlayerfrom'chimee-player';constchimee=newChimeePlayer({wrapper:'#wrapper',src:'http://cdn.toxicjohann.com/lostStar.mp4',controls:false,autoplay:true});
TODO: more coming soon!~
- What is Chimee?
- What is Chimee's plugin?
- How do I write a plugin?
- How do I write an advertising plugin??
- How do I write a UI plugin?
You will find four different builds in the lib.
Name | Kind | Meaning | Define environment? |
---|---|---|---|
index.js | commonjs | Common javascript, mostly used in Webpack 1. | Yes |
index.mjs | esmodule | An es module, mostly used in Webpack 2 and rollup. | Yes |
index.browser.js | umd | Can be used directly in browser | No (It's in development) |
index.min.js | umd | Can be used directly in browser | No (It's in production) |
Index.esm.js | esmodule | An es module, mostly used in browser es module | No (It's in development) |
Development/production modes are hard-coded for the UMD builds: the un-minified files are for development, and the minified files are for production.
CommonJS and ES Module builds are intended for bundlers, therefore we don’t provide minified versions for them. Developers are be responsible for minifying the final bundle themselves.
CommonJS and ES Module builds also preserve raw checks forprocess.env.NODE_ENV
to determine the mode they should run in. Developers should use appropriate bundler configurations to replace these environment variables in order to control which mode Vue will run in. Replacingprocess.env.NODE_ENV
with string literals also allows minifiers like UglifyJS to completely drop the development-only code blocks, agressively reducing final file size.
Use Webpack’sDefinePlugin:
varwebpack=require('webpack')module.exports={// ...plugins:[// ...newwebpack.DefinePlugin({'process.env':{NODE_ENV:JSON.stringify('production')}})]}
constreplace=require('rollup-plugin-replace')rollup({// ...plugins:[replace({'process.env.NODE_ENV':JSON.stringify('production')})]}).then(...)
Install this project
npm installnpm start
Then openhttp://127.0.0.1:10001/demo/base/index.html
You can choose another page as you want
Please read therelease notes.
Please read therelease notes.
You can donate to us through Alipay. That will keep us moving.
About
a video player framework aims to bring wonderful experience on browser