5.1.1 • Published 10 months ago

@easydarwin/easyplayer v5.1.1

Weekly downloads
14
License
MIT
Repository
-
Last release
10 months ago

EasyPlayer.js

简介

集播放http-flv, hls, websocket 于一身的H5视频直播/视频点播播放器, 使用简单, 功能强大;

功能说明

  • 支持 MP4 播放

  • 支持 m3u8/HLS 播放;

  • 支持 HTTP-FLV/WS-FLV 播放;

  • 支持直播和点播播放;

  • 支持播放器快照截图;

  • 支持点播多清晰度播放;

  • 支持全屏或比例显示;

  • 自动检测 IE 浏览器兼容播放;

  • 支持重连播放;

HTML 集成示例

  • 使用方式

  • 普通集成

copy dist/element/EasyPlayer-element.min.js 到 www 根目录

在 html 中引用 dist/element/EasyPlayer-element.min.js

<!DOCTYPE html>
<html>
<head>
  <title>easyplayer</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="EasyPlayer-element.min.js"></script>
</head>
<body>
<easy-player
  video-url="rtmp://live.hkstv.hk.lxdns.com/live/hks2"
  live="true"
  stretch="true"
></easy-player>
<easy-player
  video-url="http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8"
  live="false"
  stretch="true"
></easy-player>
<easy-player
  video-url="http://live.hkstv.hk.lxdns.com/flv/hks.flv"
  live="true"
  stretch="true"
></easy-player>
</body>
</html>
  • vue集成
  npm install @easydarwin/easyplayer --save
  • Vue 集成调用

copy node_modules/@easydarwin/easyplayer/dist/component/crossdomain.xml 到 静态文件 根目录

copy node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer-lib.min.js 到 静态文件 根目录

注意: 没有调用会出现无法加载对应插件的报错

在 html 中引用 dist/component/EasyPlayer-lib.min.js

H.265

copy node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer.wasm 到 静态文件 根目录

demo

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
  <link rel="icon" href="<%= BASE_URL %>favicon.ico"/>
  <title>EasyPlayer-demo</title>
  <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
  <script src="./EasyPlayer-lib.min.js"></script>
</head>
<body>
<noscript>
  <strong
  >We're sorry but easynvr-token doesn't work properly without JavaScript
    enabled. Please enable it to continue.</strong
  >
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

更多使用demo 详情见 node_modules/@easydarwin/easyplayer/dist/element/index.html

效果演示

npm.io

  • npm集成
......

<easy-player
  live
  muted
  autoplay
  :video-url="camera.videoSrc"
  style="width: 100%;height: 200px"
  @error="restartPlayer"
/>

...... ...... import EasyPlayer from '@easydarwin/easyplayer'; ......
components: { EasyPlayer }

配置属性

参数说明类型默认值
alt视频流地址没有指定情况下, 视频所在区域显示的文字String无信号
aspect视频显示区域的宽高比String16:9
autoplay自动播放Booleantrue
currentTime设置当前播放时间Number0
decode-type解码类型 仅支持flv (soft: 强制使用wasm模式)Stringauto
easyStretch是否不同分辨率强制铺满窗口Booleanfalse
live是否直播, 标识要不要显示进度条Booleantrue
loop是否轮播。Booleanfalse
muted是否静音Booleantrue
poster视频封面图片String-
reconnection视频出错时自动重连Booleanfalse
resolution仅支持hls流; 供选择的清晰度 fhd:超清,hd:高清,sd:标清String"yh,fhd,hd,sd"
resolutionDefault仅支持hls流String"hd"
video-url视频地址String-
has-audio是否渲染音频(音频有问题,请设置成false)仅支持flvBooleantrue
video-title视频右上角显示的标题String-
recordMaxFileSize录像文件大小(MB)Number200

事件回调

方法名说明参数
play播放事件
pause暂时事件
error播放异常
ended播放结束或直播断流
timeupdate当前播放时间回调currentTime

Vue方法

方法名说明参数
initPlayer初始化播放器
destroyPlayer销毁播放器
switchVideo播放开关
switchAudio静音开关
fullscreen全屏
exitFullscreen退出全屏
changeStretch视频拉伸模式
snapshot保存快照
switchRecording录像开关

更多流媒体音视频资源

EasyDarwin开源流媒体服务器:www.EasyDarwin.org

EasyDSS高性能互联网直播服务:www.EasyDSS.com

EasyNVR安防视频可视化服务:www.EasyNVR.com

EasyNVS视频综合管理平台:www.EasyNVS.com

EasyNTS云组网:www.EasyNTS.com

EasyGBS国标GB/T28181服务器:www.EasyGBS.com< /a>

EasyRTS应急指挥平台:www.EasyRTS.com

TSINGSEE青犀开放平台:open.TSINGSEE.com

Copyright © www.TSINGSEE.com Team 2012-2021

开放平台

EasyPlayer群1:544917793(已满) EasyPlayer群2:161592199 EasyRTMP: 58725484

青犀TSINGSEE

5.1.1

10 months ago

5.0.7

1 year ago

5.0.5

2 years ago

5.0.3

2 years ago

5.0.0

2 years ago

4.1.4

2 years ago

4.1.3

2 years ago

4.1.2

2 years ago

4.0.5

2 years ago

4.0.7

2 years ago

4.0.6

2 years ago

4.1.0

2 years ago

4.0.4

2 years ago

4.0.1

2 years ago

4.0.2

2 years ago

3.3.12

2 years ago

3.3.11

3 years ago

3.3.10

3 years ago

3.3.9

3 years ago

3.3.8

3 years ago

3.3.7

3 years ago

3.2.10

3 years ago

3.2.9

3 years ago

3.2.8

3 years ago

3.2.7

3 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago