multimediajs
v1.0.2
Published
```shell npm i multimediajs -S ``` ## Quick Start ``` javascript import Video from 'multimediajs'; new Video(this.$refs.gbox).init() ```
Downloads
2
Readme
Install
npm i multimediajs -S
Quick Start
import Video from 'multimediajs';
new Video(this.$refs.gbox).init()
Usage
dom结构自己定义 但是class必须是这些
音频
<div class="g-box" ref="gbox">
<div class="g-player">
<audio :src="audioUrl" class="player" volume="1">您的浏览器不支持 audio 标签</audio>
</div>
<div class="g-operation">
<div class="progress-bar enlargeb">
<span class="progress-done" />
<span class="operation-btn enlarge switch">
<img src="../../assets/play.png" class="play" />
<img src="../../assets/pause.png" class="pause" />
</span>
</div>
<div class="time-line">
<span class="current-time">00:00</span>
<span class="total-time">00:00</span>
</div>
</div>
</div>
.g-box {
position: relative;
}
.player {
width: 100%;
position: relative;
}
.g-operation {
bottom: 0;
//position: absolute;
width: 100%;
}
.time-line {
overflow: hidden;
margin-top: 12px;
margin-bottom: 7px;
font-size: 10px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: rgba(151, 151, 151, 1);
line-height: 14px;
display: flex;
justify-content: space-between;
}
.progress-bar {
height: 3px;
background: #979797;
border-radius: 1px;
position: relative;
}
.progress-done {
background: #fff;
border-radius: 3px;
height: 5px;
width: 0;
position: absolute;
left: 0;
top: 50%;
margin-top: -2.5px;
padding: 0 2px;
}
.operation-btn {
position: absolute;
width: 20px;
height: 20px;
border-radius: 100%;
top: 50%;
margin-top: -10px;
background: #fff;
box-shadow: 0 0 5px 1px #fff;
text-align: center;
line-height: 20px;
img {
width: 8px;
height: 8px;
}
.play {
margin-left: 2px;
}
}
.enlarge::after {
content: '';
position: absolute;
left: -10px;
top: -10px;
right: -10px;
bottom: -10px;
}
.enlargeb::before {
content: '';
position: absolute;
left: -10px;
top: -10px;
right: -10px;
bottom: -10px;
}
.icos {
float: right;
}
.pause {
display: none;
}
.vol-box {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
}
.vol-bar {
position: absolute;
bottom: 30px;
width: 6px;
height: 50px;
background: pink;
display: none;
}
.unvol {
display: none;
}
.full-screen {
margin-left: 26px;
}
.vol-btn {
position: absolute;
width: 100%;
height: 8px;
background: yellow;
}
.iconfont {
font-size: 26px;
color: pink;
}
视频
<div class="g-box" ref="gbox">
<div class="g-player">
<video src="http://www.170mv.com/tool/jiexi/ajax/pid/13134/vid/3242313.mp4" class="player" volume="1"></video>
<img src="https://img2.soyoung.com/upload/20180604/3/20180604205305422.jpg" class="poster"/>
</div>
<div class="g-operation">
<div class="first-line">
<span class="switch">
<i class="iconfont icon-bofang play"></i>
<i class="iconfont icon-zanting1 pause"></i>
</span>
<div class="time">
<span class="current-time">00:00</span>/
<span class="total-time">12:00</span>
</div>
<div class="icos">
<span class="vol-box">
<span class="vol-bar">
<span class="vol-btn"></span>
</span>
<span class="switch-vol">
<i class="vol iconfont icon-laba"></i>
<i class="unvol iconfont icon-jingyin"></i>
</span>
</span>
<i class="full-screen iconfont icon-fangda"></i>
</div>
</div>
<div class="progress-bar">
<span class="operation-btn"></span>
</div>
</div>
</div>
.g-box{
position: relative;
margin-bottom:50px;
}
.player{
width:100%;
position: relative;
}
.poster{
position: absolute;
width:100%;
top:0;
}
.g-operation{
bottom:0px;
position: absolute;
width:100%;
background: rgba(0,0,0,.5)
}
.first-line{
overflow: hidden;
}
.progress-bar{
height:15px;
background: #ffffff82;
position: relative;
}
.operation-btn{
position: absolute;
width:15px;
height:100%;
top:0;
background:pink;
}
.time{
display: inline-block;
color:#fff
}
.icos{
float:right
}
.pause{
display: none;
}
.vol-box{
position: absolute;
display: flex;
justify-content: center;
align-items: center;
}
.vol-bar{
position: absolute;
bottom: 30px;
width:6px;
height:50px;
background: pink;
display: none;
}
.unvol{
display: none;
}
.full-screen{
margin-left: 26px;
}
.vol-btn{
position: absolute;
width:100%;
height:8px;
background: yellow
}
.iconfont{
font-size: 26px;
color:pink
}
| prop | desc | type | default | other | example | ------ | ------ | ------ | ------ | ------ | ------ | | | | | "" | 可传 |