Simple plugin to zoom in video.js player
- With browser Video.js
- With npm
npm istall video.js
- With yarn
yarn add video.js
- With browser Download
- With npm
npm install @theonlyducks/videojs-zoom@latest
- With yarn
yarn add @theonlyducks/videojs-zoom@latest
- With Browser
<link rel="stylesheet" type="text/css" href="/dist/videojs-zoom.css">
<script src="/dist/videojs-zoom.js"></script>
- With Node
import '@theonlyducks/videojs-zoom/styles';
import '@theonlyducks/videojs-zoom';
const video = videojs('my-video');
const zoomPlugin = video.zoomPlugin();
zoomPlugin.listen('change', data => {
console.log(data);
});
Zoom function
-
value
- type:
Number
- type:
const zoomPlugin = video.zoomPlugin();
zoomPlugin.zoom(2);
Rotate function
-
value
- type:
Number
in deg
- type:
const zoomPlugin = video.zoomPlugin();
zoomPlugin.rotate(180);
Rotate function
-
x
- type:
Number
- type:
-
y
- type:
Number
- type:
const zoomPlugin = video.zoomPlugin();
zoomPlugin.move(0, 0);
Open and close modal function
const zoomPlugin = video.zoomPlugin();
zoomPlugin.toggle();
Flip video image
-
x
- type:
String
use + or - for flip image
- type:
const zoomPlugin = video.zoomPlugin();
zoomPlugin.flip("-");
Enable the plugin if it is disabled
const zoomPlugin = video.zoomPlugin();
zoomPlugin.enablePlugin();
Disables all visual features of the plugin if enabled
const zoomPlugin = video.zoomPlugin();
zoomPlugin.disablePlugin();
Example:
const zoomPlugin = video.zoomPlugin({
showZoom: true,
showMove: true,
showRotate: true,
gestureHandler: false
});
-
showZoom
show/hide +- zoom buttons. defaulttrue
-
showMove
show/hide up, left, right, reset and down buttons. defaulttrue
-
showRotate
show/hide rotate and flip buttons. defaulttrue
-
gestureHandler
enable gesture zoom drag and drop, wheel. defaultfalse
Listen events of the zoom plugin
-
event
- type:
String
- options:
-
'change'
when click in buttons modal -
'click'
when modal is opened or closed
-
- type:
-
callback
- type:
Function
- type:
const zoomPlugin = video.zoomPlugin();
zoomPlugin.listen('click', () => {
console.log('click');
});
Install
yarn
Start server listening https://localhost:3000
yarn start