Socket
Book a DemoInstallSign in
Socket

react-tcplayer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tcplayer

react-tcplayer

1.0.1
latest
npmnpm
Version published
Weekly downloads
23
-73.56%
Maintainers
1
Weekly downloads
 
Created
Source

TCPlayer 的 React 封装

使用说明

  • 安装插件
npm install react-tcplayer
  • public/index.html 中在 heah 中添加播放器插件 js
<head>
   <script src="//imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.3.2.js" charset="utf-8"></script>
</head>
  • 页面中使用
<div style={{ width: '400px', height: '300px' }}>
  <ReactTcplayer src={src} poster={{style:"stretch", src:"imgPath"}}}/>
</div>

播放器组件的宽度和高度由父级容器的高宽来决定,每次设置新的 src 时会重新获取高宽

参数说明

参数类型说明
srcstring视频源地址,支持 rtmp 和 hls
posterobject无视频流时显示的图像及样式
poster.stylestring图片填充方式:
default:居中并且以图片的实际分辨率进行显示。
stretch:拉伸铺满播放器区域,图片可能会变形。
cover:优先横向等比拉伸铺满播放器区域,图片某些部分可能无法显示在区域内。
poster.srcstring图片访问路径

Keywords

react

FAQs

Package last updated on 22 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.