h7-video-player
v1.0.2
Published
yes
Downloads
1
Readme
H5 Video Player
Browser full screen H5 video player. (Releases | Demo)
Install
$ npm install h5-video-player --save
# or
$ yarn add h5-video-player
Use
import H5VideoPlayer from 'h5-video-player';
# OR
let H5VideoPlayer = require('h5-video-player');
let videoPlayer = new H5VideoPlayer(source, [, options]);
videoPlayer.load();
source
: Video source allows three types- [String]: Video url. E.g:
'Avengers: Endgame'
- [Object]: Video url and type. E.g:
{url: 'video.mp4', type:'mp4'}
- [Array]: E.g:
[{url: 'video.mp4', type:'mp4'},{},...]
- [String]: Video url. E.g:
options
context
: [Element|String] Context Wrapper Element. Default'body'
.positioned
: [Boolean] Whether the context element has been positioned. Defaultfalse
.control
: [Boolean] Whether the user can control. Defaultfalse
.autoPlay
: [Boolean] Whether to play immediately after loading. Defaultfalse
.autoClose
: [Boolean] Whether to close immediately when the video played off. Defaulttrue
.preload
: [Boolean] Whether to preload the video. Defaulttrue
.orientation
: [String] landscape / portrait. Default'portrait'
.aspectRatio
: [Number] Video aspect ratio. Default9 / 16
.disableRotation
: [Boolean] Whether to prohibit automatic rotation. Defaultfalse
.picMode
: [Boolean] picture mode (no playButton). Defaultfalse
.fixAndroidWechatContinue
: [Boolean] Whether compatible with Wechat(Android) play after Forced to pause. Defaultfalse
.hookInPlay
: [Function] The hook function when the video play.hookInPause
: [Function] The hook function when the video pause.hookInStop
: [Function] The hook function when the video stop.
function
load()
: init videoplay()
: video playpause()
: video pause
Use in browser
<div id="videoWrapper"></div>
<script src="H5VideoPlayer.min.js"></script>
<script>
var source = 'media/video.mp4';
var video = new H5VideoPlayer(source, {
context: '#videoWrapper',
[...options]
}).load();
</script>
CDN
To use via a CDN include this in your html:
<script src="https://cdn.jsdelivr.net/npm/h5-video-player@1/build/H5VideoPlayer.min.js"></script>