Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/virgoone/vplyr
https://github.com/virgoone/vplyr
flv html5-video video-player
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/virgoone/vplyr
- Owner: virgoone
- License: mit
- Created: 2016-08-22T06:42:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-02-28T03:14:58.000Z (11 months ago)
- Last Synced: 2025-01-12T14:22:03.985Z (2 days ago)
- Topics: flv, html5-video, video-player
- Language: JavaScript
- Homepage: http://vplyr.marryto.me/
- Size: 1.17 MB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vPlyr
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php) [![NPM version](https://badge.fury.io/js/vplyr.svg)](http://badge.fury.io/js/vplyr) [![npm](https://img.shields.io/npm/dt/vplyr.svg)](https://www.npmjs.com/package/vplyr)A simple, HTML5, FLV media player.
[Checkout the demo](http://vplyr.marryto.me)
## Using package managers
### npm
```
npm install vplyr
```
[https://www.npmjs.com/package/vplyr](https://www.npmjs.com/package/vplyr)## Quick setup
#### HTML5 Video
### HTML
```html```
### CSS
Include the `vplyr.css` stylsheet into your `````html
```
### JavaScript
Include the `vplyr.js` script before the closing `` tag and then call `new vPlayer(tag,options)````html
new vPlayer(document.querySelector('video'), { debug: false })
```## API
API
Required
Description
container
—
返回播放器容器get : player.container
poster
—
get or set video posterget : player.poster | set player.poster = '图片地址'
readyState
—
返回视频播放器状态
loadingState
—
返回视频加载状态
duration
—
返回视频总时间
play()
—
开始播放视频
pause()
—
暂停播放视频
stop()
—
停止播放视频
currentTime
— | Number
拿到或者设置视频当前播放时间get : player.currentTime | set player.currentTime = Number
volume
— | Number
返回或者设置视频音量get : player.volume | set player.volume = Number
muted
— | Boolean
返回或者设置视频静音get : player.muted | set player.muted = true || false
togglePlay()
Boolean
切换视频播放状态
paused
—
返回视频当前播放状态
toggleMute()
—
切换视频静音状态
toggleFullscreen()
Event
切换视频全屏状态
playing(...)
Event
监听视频播放事件,callback返回视频当前播放时间
fullscreen
— | Boolean
返回或者设置当前视频全屏get : player.fullscreen | set player.fullscreen = true || false
src
— | String
返回或者设置当前视频地址
get : player.src | set player.src = '视频地址'
destroy()
—
销毁视频播放器,重置状态
## Thanks
- [Plyr](https://github.com/selz/plyr)
- [Flv.js](https://github.com/Bilibili/flv.js)## Copyright and License
[The MIT license](license.md).