LivePlayer H5 player
H5 live/on-demand player, simple to use, powerful, free to use
- Supports M3U8 playback;
- Supports HTTP-FLV playback.
- Support RTMP playback;
- Support live broadcast and on-demand broadcast;
- Player snapshot screenshot support;
- Support on-demand multi definition playback;
- Support full screen or proportional display;
- Built-in Flash supports extreme speed and smooth mode;
- The built-in Flash supports HTTP-FLV playback.
- Automatic detection of Internet Explorer compatible playback;
Properties (Property)
video-url
Video streaming address String default ‘ ‘video-title
The title String default ‘shown in the top right corner of the videoposter
Video Cover image String default ‘autoplay
Autoplay Boolean default trueloop
Boolean default false Indicates whether to looplive
Boolean default false Indicates whether to display a progress baralt
If the video stream address is not specified, the text displayed in the video area is equivalent to the Alt attribute of the HTML IMG tag String default ‘No signal’.muted
Mute Boolean Default falseaspect
The width to height ratio of the video display area is fullscreen. String default ’16:9′loading
Indicates load status, with support for sync modifierfluent
Fluent mode, Boolean default truestretch
Stretch, Boolean default falsetimeout
M3u8 Loading timeout (seconds) Number default 20show-custom-button
Whether to display custom buttons in the toolbar (Extreme/Smooth, Stretch/standard), Boolean default trueresolution
For example, “YH, FHD, HD, SD” (Description: YH: original resolution, FHD: ultra hd, HD: HIGH definition, SD: standard definition. If this parameter is not configured, this parameter is not enabled. You need to provide multiple resolution sources, such as the original picture sourceTest.m3u8, then the hd source istest_hd.m3u8 )resolutiondefault
Default playback clarity String “HD”hasaudio
Use when http-FLv plays: Audio or not, pass this property to handle audio or video only source Boolean, automatic judgment is not configured by defaulthasvideo
Use when http-FLV plays: Whether there is video, pass this property to handle audio – or video-only source Boolean. Automatic judgment is not configured by default
Method (Medthod)
getCurrentTime
Gets the current playback time progress and synchronously returns the playback time progress datasnap
After a snapshot is obtained using an external API, a snapOutside Event is triggered
Events (Event)
message
Trigger notification message, parameters: {type: ‘ ‘, message: ‘ ‘}ended
When the playback is complete, the parameter is nonetimeupdate
Progress update, parameter: current time progresspause
Pause, parameter: current time progressplay
Play, parameter: current time progresssnapOutside
External snapshot callback. Parameter: Snapshot Base64 datasnapInside
Internal snapshot callback triggered by the snapshot button in the control bar. Parameter: Snapshot Base64 data
Install
The installation
npm install @liveqing/liveplayer
Or download the version pack
Used in Vue
Copy node_modules / @ liveqing/liveplayer/dist/component/liveplayer SWF to the root directory of the WWW
Copy node_modules / @ liveqing liveplayer/dist/component/crossdomain. The XML to the root directory of the WWW
Copy/node_modules / @ liveqing liveplayer/dist/component/liveplayer – lib. Min. Js to the root directory of the WWW
Copy is done via webpack. Edit your webpack.config.js
.// copy js lib and swf files to dist dir
new CopyWebpackPlugin([
{ from: 'node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml'},
{ from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf'},
{ from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js'.to: 'js/'}]),...Copy the code
Reference the WWW root directory liveplayer-lib.min.js in HTML
Edit your Vue components
. import LivePlayer from '@liveqing/liveplayer' ...... components: { LivePlayer } ...... <LivePlayer :videoUrl="videoUrl" fluent autoplay live stretch></LivePlayer>Copy the code
Out of Vue
Copy node_modules / @ liveqing/liveplayer/dist/element/liveplayer SWF to the root directory of the WWW
Copy node_modules / @ liveqing liveplayer/dist/element/crossdomain. The XML to the root directory of the WWW
Copy/node_modules / @ liveqing liveplayer/dist/element/liveplayer – element. Min. Js to the root directory of the WWW
Reference the WWW root directory liveplayer-element.min.js in HTML
Integrated HTML Demo
<! DOCTYPEHTML>
<html>
<head>
<title>liveplayer</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
<script type="text/javascript" src="liveplayer-element.min.js"></script>
</head>
<body>
<live-player video-url="rtmp://live.hkstv.hk.lxdns.com/live/hks" live="true" stretch="true"></live-player>
<live-player video-url="http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8" live="false" stretch="true"></live-player>
<live-player video-url="http://live.hkstv.hk.lxdns.com/flv/hks.flv" live="true" stretch="true"></live-player>
<live-player video-url=Ws: / / "192.168.1.65:3000 / play? The stream = RTSP: / / username: [email protected]:5504 / Streaming/Channels / 102"></live-player>
</body>
</html>
Copy the code
To learn more
LiveQing Security streaming media service -QQ communication group: 615081503
LiveGBS GB GB28181-QQ communication group: 947137753
WEB:www.liveqing.com
Copyright © 2016-2019 at LiveQing.com