mirror of
https://github.com/kmoskwiak/videojs-resolution-switcher.git
synced 2025-10-04 02:09:41 +02:00
readme, version
This commit is contained in:
parent
940c95ae67
commit
26fd89ecb0
3 changed files with 49 additions and 17 deletions
58
README.md
58
README.md
|
@ -1,4 +1,4 @@
|
||||||
# Video.js Test
|
# Video.js Resolution Switcher
|
||||||
|
|
||||||
A revolutionary plugin for video.js
|
A revolutionary plugin for video.js
|
||||||
|
|
||||||
|
@ -7,27 +7,61 @@ A revolutionary plugin for video.js
|
||||||
Once you've added the plugin script to your page, you can use it with any video:
|
Once you've added the plugin script to your page, you can use it with any video:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
<video id='video'></video>
|
||||||
<script src="video.js"></script>
|
<script src="video.js"></script>
|
||||||
<script src="videojs-resolution-switcher.js"></script>
|
<script src="videojs-resolution-switcher.js"></script>
|
||||||
<script>
|
<script>
|
||||||
videojs(document.querySelector('video')).test();
|
videojs('video', {
|
||||||
|
controls: true
|
||||||
|
}, function(){
|
||||||
|
|
||||||
|
// Add dynamically sources via newVideoSources method
|
||||||
|
player.newVideoSources([
|
||||||
|
{
|
||||||
|
src: 'http://media.xiph.org/mango/tears_of_steel_1080p.webm',
|
||||||
|
type: 'video/webm',
|
||||||
|
label: '360'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: 'http://mirrorblender.top-ix.org/movies/sintel-1024-surround.mp4',
|
||||||
|
type: 'video/mp4',
|
||||||
|
label: '720'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
player.on('resolutionchange', function(){
|
||||||
|
console.info('Source changed to %s', player.src())
|
||||||
|
})
|
||||||
|
|
||||||
|
}).videoJsResolutionSwitcher();
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
There's also a [working example](example.html) of the plugin you can check out if you're having trouble.
|
There's also a [working example](example.html) of the plugin you can check out if you're having trouble.
|
||||||
|
|
||||||
## Documentation
|
## Methods
|
||||||
### Plugin Options
|
|
||||||
|
|
||||||
You may pass in an options object to the plugin upon initialization. This
|
|
||||||
object may contain any of the following properties:
|
|
||||||
|
|
||||||
#### option
|
### newVideoSources([source])
|
||||||
Type: `boolean`
|
|
||||||
Default: true
|
|
||||||
|
|
||||||
An example boolean option that has no effect.
|
```javascript
|
||||||
|
|
||||||
|
// Update video sources
|
||||||
|
player.newVideoSources([
|
||||||
|
{ type: "video/mp4", src: "http://www.example.com/path/to/video.mp4", label: 'SD' },
|
||||||
|
{ type: "video/mp4", src: "http://www.example.com/path/to/video.mp4", lable: 'HD' },
|
||||||
|
{ type: "video/mp4", src: "http://www.example.com/path/to/video.mp4", label: '4k' }
|
||||||
|
])
|
||||||
|
|
||||||
|
```
|
||||||
|
#### PARAMETERS:
|
||||||
|
* source `Array` array of sources
|
||||||
|
|
||||||
|
|
||||||
|
## Events
|
||||||
|
|
||||||
|
### resolutionchange `EVENT`
|
||||||
|
|
||||||
|
> Fired when resolution is changed
|
||||||
|
|
||||||
## Release History
|
|
||||||
|
|
||||||
- 0.1.0: Initial release
|
|
||||||
|
|
|
@ -56,8 +56,6 @@
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
window.player = player;
|
|
||||||
|
|
||||||
player.on('resolutionchange', function(){
|
player.on('resolutionchange', function(){
|
||||||
console.info('Source changed to %s', player.src())
|
console.info('Source changed to %s', player.src())
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "videojs-test",
|
"name": "videojs-resolution-switcher",
|
||||||
"version": "0.0.0",
|
"version": "0.1.0",
|
||||||
"author": "Kasper Moskwiak",
|
"author": "Kasper Moskwiak",
|
||||||
"description": "A revolutionary plugin for video.js",
|
"description": "Resolution switcher for video.js 5",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"videojs",
|
"videojs",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue