Socket
Book a DemoInstallSign in
Socket

vue-mini-player

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-mini-player

基于 Vue 一个轻量级视频播放器

0.2.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source


> 基于 Vue 的一个轻量级视频播放组件,适配 PC 和移动端

安装

$ npm install vue-mini-player -S

使用

# main.js
import vueMiniPlayer from 'vue-mini-player'
import 'vue-mini-player/lib/vue-mini-player.css'
Vue.use(vueMiniPlayer)

在项目中使用 vueMiniPlayer

<template>
  <vueMiniPlayer ref="vueMiniPlayer" :video="video" :mutex="true" @fullscreen="handleFullscreen" />
</template>
<script>
  export default {
    data () {
      return {
        video: {
            url: 'https://api.dogecloud.com/player/get.mp4?vcode=5ac682e6f8231991&userId=17&ext=.mp4',
            cover: 'https://i.loli.net/2019/06/06/5cf8c5d9c57b510947.png',
            muted: false,
            loop: false,
            preload: 'auto',
            poster: '',
            volume: 1,
            autoplay: false
        }
      }
    },
    computed(){
      $video(){
        return this.$refs.vueMiniPlayer.$video;
      }
    },
    methods:{
      handleFullscreen(){

      }
    }
  }
</script>

💡 特色

1.轻量级 HTML5 播放器,精美 UI 控件,简单易上手

2.提供以 npm 的形式安装提供全局组件

3.多格式视频配置,移动端+PC 通用模式

  • 多类型视频支持
  • 自定义海报
  • 多平台兼容
  • 静音开关
  • 播放时间进度
  • 全屏支持
  • 拖动播放
  • 倍速播放
  • MSE 支持
  • 弹幕支持

✈️ 参数

名称默认值类型描述
video-视频相关参数
mutexfalseBoolean互斥,阻止多个播放器同时播放,当前播放器播放时暂停其他播放器
video.url-String,Array视频播放源,支持 Array 形式传入多种视频格式
video.cover-String视频海报
video.mutedfalseBoolean是否静音播放
video.loopfalseBoolean视频是否循环播放
video.preload'auto'String视频预加载,可选值: 'none', 'metadata', 'auto'
video.poster-String原生视频默认海报暂不设置,只设置 video.cover
video.volume1String,Number默认音量
video.autoplayfalseBoolean视频自动播放
video.playsinlinefalseBoolean视频行内播报
video.crossOriginfalseString视频源跨域 corss 可选值: 'anonymous', 'use-credentials'
video.logo-String播放器 logo
video.logoStyle-Object,String播放器 logo 样式,参数格式为{color:'#fff'} or "color:#fff"

🚀 事件

名称描述
fullscreen全屏事件
ready视频播放器准备好
clearMode清洁模式执行
videoPlay播放器执行 play 或者 pause
created组件生命周期
mounted组件生命周期
beforeDestroy组件生命周期
destroyed组件生命周期

FAQs

Package last updated on 09 Dec 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.