forked from bytedance/xgplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yinguohui
committed
Jun 24, 2018
1 parent
1a13d8a
commit e77ee95
Showing
375 changed files
with
78,867 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"node": true | ||
} | ||
}] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "path": "cz-conventional-changelog" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/* | ||
browser/* | ||
dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
"extends": "standard" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<div align="center"> | ||
<img src="./xgplayer.png" width="384" height="96"> | ||
</div> | ||
<div align="center"> | ||
<a href="https://www.npmjs.com/package/xgplayer" target="_blank"> | ||
<img src="https://img.shields.io/npm/v/xgplayer.svg" alt="npm"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/xgplayer"> | ||
<img src="https://img.shields.io/npm/dm/xgplaer.svg" alg="download"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/xgplayer" target="_blank"> | ||
<img src="https://img.shields.io/npm/l/xgplayer.svg" alt="license"> | ||
</a> | ||
<a href="http://commitizen.github.io/cz-cli/"> | ||
<img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg" alt="commitizen"> | ||
</a> | ||
</div> | ||
|
||
|
||
### Introduction | ||
|
||
xgplayer is a web video player library. it has designed a separate, detachable UI component based on the principle that everything is componentized. More importantly, it is not only flexible in the UI layer, but also bold in its functionality: it gets rid of video loading, buffering, and format support for video dependence. Especially on mp4 | ||
it can be staged loading for that does not support streaming mp4. This means seamless switching with clarity, load control, and video savings. It also integrates on-demand and live support for FLV, HLS, and dash. [Document](http://h5player.bytedance.com/) | ||
|
||
### Start | ||
|
||
1. Install | ||
|
||
``` | ||
$ npm install xgplayer | ||
``` | ||
2. Usage | ||
Step 1: | ||
```html | ||
<div id="vs"></div> | ||
``` | ||
Step 2: | ||
```js | ||
import Player from 'xgplayer' | ||
let player=new Player({ | ||
id:'vs', | ||
url:'http://s2.pstatp.com/cdn/expire-1-M/byted-player-videos/1.0.0/xgplayer-demo.mp4' | ||
}) | ||
``` | ||
This is the easiest way to configure the player,then it runs with video. For more advanced content, see the plug-in section or documentation. [more config](http://h5player.bytedance.com/config) | ||
### Plugins | ||
xgplayer provides more plugins, plugins are divided into two categories: one is self-starting, and another inherits the player's core class named xgplayer. In principle, the officially provided plug-ins are self-starting and the packaged third-party libraries are inherited. Some feature plug-ins themselves can provide a downgrade scenario that suggests a self-start approach, or an inheritance approach if not. The player supports custom plugins for more content viewing [plugins](http://h5player.bytedance.com/plugins/) | ||
The following is how to use a self-starting plug-in: | ||
```js | ||
import Player from 'xgplayer' | ||
import 'xgplyaer-mp4' | ||
let player=new Player({ | ||
id:'video', | ||
url:'//abc.com/test.mp4' | ||
}) | ||
``` | ||
|
||
<code>xgplayer-mp4</code>plugin is self-starting, It loads mp4 video itself, parses mp4 format, implements custom loading, buffering, seamless switching, and so on. it will automatically downgrade devices that do not support [MSE](https://www.w3.org/TR/media-source/). [details](http://h5player.bytedance.com/plugins/#xgplayer-mp4) | ||
|
||
|
||
|
||
### Mobile Support | ||
|
||
xgplayer supports mobile terminal, but android device brand and system are numerous, there are much compatibility problems, the player provides whitelist mechanism to ensure the perfect operation in mobile terminal. [whitelist](http://h5player.bytedance.com/config/#%E7%99%BD%E5%90%8D%E5%8D%95) | ||
|
||
|
||
|
||
### Dev | ||
|
||
``` | ||
$ git clone [email protected]:bytedance/xgplayer.git | ||
$ cd xgplayer | ||
$ npm install | ||
$ npm run dev | ||
``` | ||
|
||
please visit [http://localhost:9090/examples/index.html](http://localhost:9090/examples/index.html) | ||
|
||
### License | ||
|
||
[MIT](http://opensource.org/licenses/MIT) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<div align="center"> | ||
<img src="./xgplayer.png" width="384" height="96"> | ||
</div> | ||
<div align="center"> | ||
<a href="https://www.npmjs.com/package/xgplayer" target="_blank"> | ||
<img src="https://img.shields.io/npm/v/xgplayer.svg" alt="npm"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/xgplayer"> | ||
<img src="https://img.shields.io/npm/dm/xgplaer.svg" alg="download"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/xgplayer" target="_blank"> | ||
<img src="https://img.shields.io/npm/l/xgplayer.svg" alt="license"> | ||
</a> | ||
<a href="http://commitizen.github.io/cz-cli/"> | ||
<img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg" alt="commitizen"> | ||
</a> | ||
</div> | ||
|
||
|
||
### 概述 | ||
|
||
|
||
西瓜播放器是一个Web视频播放器类库,它本着一切都是组件化的原则设计了独立可拆卸的 UI 组件。更重要的是它不只是在 UI 层有灵活的表现,在功能上也做了大胆的尝试:摆脱视频加载、缓冲、格式支持对 video 的依赖。尤其是在 mp4 点播上做了较大的努力,让本不支持流式播放的 mp4 能做到分段加载,这就意味着可以做到清晰度无缝切换、加载控制、节省视频流量。同时,它也集成了对 flv、hls、dash 的点播和直播支持。[文档](http://h5player.bytedance.com/) | ||
|
||
|
||
|
||
### 起步 | ||
|
||
1. 安装 | ||
|
||
``` | ||
$ npm install xgplayer | ||
``` | ||
2. 使用 | ||
- Step 1: | ||
```html | ||
<div id="vs"></div> | ||
``` | ||
- Step 2: | ||
```js | ||
import Player from 'xgplayer' | ||
let player=new Player({ | ||
id:'vs', | ||
url:'http://s2.pstatp.com/cdn/expire-1-M/byted-player-videos/1.0.0/xgplayer-demo.mp4' | ||
}) | ||
``` | ||
这是最简单的播放器配置方法,基本功能可以跑起来,如果想使用高级功能参考插件一节或者文档。[更多配置](http://h5player.bytedance.com/config/) | ||
### 插件 | ||
西瓜播放器提供了较多的插件,插件分两类:一部分是自启动的,一部分是继承播放器核心类 xgplayer 的。原则上官方提供插件都是自启动的,封装的第三方类库都是继承方式。有些功能插件本身能提供降级方案建议使用自启动方式,否则建议使用继承方式。播放器支持自定义插件,更多内容查看 [插件](http://h5player.bytedance.com/plugins/) | ||
对于自启动的插件使用方法如下: | ||
```js | ||
import Player from 'xgplayer' | ||
import 'xgplyaer-mp4' | ||
let player=new Player({ | ||
id:'video', | ||
url:'//abc.com/test.mp4' | ||
}) | ||
``` | ||
|
||
<code>xgplayer-mp4</code>插件就是自启动的,它会自己加载 mp4 视频、解析 mp4 格式,实现自定义加载、缓冲、无缝切换等[详情]((http://h5player.bytedance.com/plugins/#xgplayer-mp4))。对于不支持 [MSE](https://www.w3.org/TR/media-source/) 的设备自动降级。 | ||
|
||
|
||
### Mobile Support | ||
|
||
西瓜播放器支持移动端,不过安卓设备品牌和系统众多,兼容性问题很多,播放器提供白名单机制保证在移动端完美的运行。[白名单机制](http://h5player/bytedance.com/config/#白名单) | ||
|
||
|
||
### Dev | ||
|
||
``` | ||
$ git clone [email protected]:bytedance/xgplayer.git | ||
$ cd xgplayer | ||
$ npm install | ||
$ npm run dev | ||
``` | ||
|
||
访问 [http://localhost:9090/examples/index.html](http://localhost:9090/examples/index.html) | ||
|
||
### License | ||
|
||
[MIT](http://opensource.org/licenses/MIT) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Koa from 'koa' | ||
import Serve from 'koa-static' | ||
import Cors from '@koa/cors' | ||
import Range from 'koa-range' | ||
|
||
const app = new Koa() | ||
app.use(Range) | ||
app.use(Cors()) | ||
|
||
app.use(Serve('.')) | ||
app.listen(9090) | ||
|
||
console.log(`server is ready,please visit http://localhost:9090/examples/index.html`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"changelog": { | ||
"repo": "cucygh/xgplayer", | ||
"labels": { | ||
"mp4": "xgplayer-mp4", | ||
"hls": "xgplayer-hls" | ||
}, | ||
"cacheDir": ".changelog" | ||
}, | ||
"version": "1.0.2" | ||
} |
Oops, something went wrong.