Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wangpengfei15975/ktPlayer
:tv: A simple & pretty HTML5 video player
https://github.com/wangpengfei15975/ktPlayer
Last synced: about 2 months ago
JSON representation
:tv: A simple & pretty HTML5 video player
- Host: GitHub
- URL: https://github.com/wangpengfei15975/ktPlayer
- Owner: wangpengfei15975
- License: mit
- Created: 2016-08-21T06:46:08.000Z (over 8 years ago)
- Default Branch: gh-pages
- Last Pushed: 2016-08-27T02:10:54.000Z (over 8 years ago)
- Last Synced: 2024-11-06T09:05:32.200Z (2 months ago)
- Language: JavaScript
- Homepage: http://www.chengfeilong.com/ktPlayer/
- Size: 38.1 KB
- Stars: 52
- Watchers: 6
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ktPlayer
[![npm](https://img.shields.io/npm/v/ktPlayer.svg)]() [![npm](https://img.shields.io/npm/dt/ktPlayer.svg)]() [![npm](https://img.shields.io/npm/l/ktPlayer.svg)]() [![npm](https://img.shields.io/badge/made%20by-Scott-orange.svg)]()
a simple HTML5 video player
一款基于HTML5的web视频播放器## Demo
[在线预览](http://www.chengfeilong.com/ktPlayer/)
预览图:
![demo](http://oc8qda7cw.bkt.clouddn.com/demo.png)## 使用方法
方式1:NPM`npm install ktPlayer`
方式2:引入该项目下的dist文件夹
---
接下来
引入css文件:
```html```
引入js文件:
```html```
写入播放器容器DOM:(可选,如未配置默认将播放器插入到body最后一个子节点.)
```html
```
创建KTPlayer对象,并初始化:
```js
//原生环境
window.onload = function(){
var player = new KTPlayer({
src:'http://oc8qda7cw.bkt.clouddn.com/mayjlee.mp4',//视频文件,必填
pic:'http://oc8qda7cw.bkt.clouddn.com/mayjlee.png',//视频截图,必填
//root:document.getElementById('container') 配置播放器插入位置,选填
});
player.init();
};
//jQuery环境
$(function(){
var player = new KTPlayer({
src:'http://oc8qda7cw.bkt.clouddn.com/mayjlee.mp4',//视频文件,必填
pic:'http://oc8qda7cw.bkt.clouddn.com/mayjlee.png',//视频截图,必填
//root:$('#container').get(0) 配置播放器插入位置,选填
});
player.init();
});
```## 致谢
部分参考:[DPlayer](https://github.com/DIYgod/DPlayer)