1.0.28 • Published 5 years ago

suwis-video v1.0.28

Weekly downloads
46
License
ISC
Repository
-
Last release
5 years ago

快速安装

npm

npm install suwis-video --save-dev

yarn

yarn add suwis-video

快速使用

import Vue from 'vue'
import suwisVideo from 'suwis-video'
Vue.use(suwisVideo)

弹窗形式

<template lang="html">
  <div>
    <suwis-video-modal
      v-model="visible"
      :options="options"
      src="http://xxx.com/xx.mp4"
      poster="http://xxx.com/xxx.jpg">
    </suwis-video-modal>
  </div>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      options: {
        // video options
        ...
      }
    }
  }
}
</script>

内联播放模式

<template lang="html">
  <div>
    <suwis-video-inline
      v-model="visible"
      :options="options"
      src="http://xxx.com/xx.mp4"
      poster="http://xxx.com/xxx.jpg">
    </suwis-video-inline>
  </div>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      options: {
        // video options
        ...
      }
    }
  }
}
</script>

options

属性说明类型默认值
render渲染模式 native/canvasStringnative
fill填充模式 fill / contain / cover / none / scale-downStringinitial
autoplay自动播放Boolean/Objectfalse
controls控制台Boolean/Objectfalse
pagination视频分页Boolean/Objectfalse
navigation导航箭头Boolean/Objectfalse
clickable是否支持点击播放/暂停Boolean/Objectfalse
modal.canclose是否显示关闭按钮Booleanfalse

事件

native 模式完全继承 w3c media 事件

属性说明参数默认值
on-abort在退出时运行的脚本。event-
on-canplay当文件就绪可以开始播放时运行的脚本(缓冲已足够开始时)。event-
on-canplaythrough当媒介能够无需因缓冲而停止即可播放至结尾时运行的脚本。event-
on-durationchange当媒介长度改变时运行的脚本。event-
on-emptied当发生故障并且文件突然不可用时运行的脚本(比如连接意外断开时)。event-
on-ended当媒介已到达结尾时运行的脚本(可发送类似“感谢观看”之类的消息)。event-
on-error当在文件加载期间发生错误时运行的脚本。event-
on-loadeddata当媒介数据已加载时运行的脚本。event-
on-loadedmetadata当元数据(比如分辨率和时长)被加载时运行的脚本。event-
on-loadstart在文件开始加载且未实际加载任何数据前运行的脚本。event-
on-pause当媒介被用户或程序暂停时运行的脚本。event-
on-play当媒介已就绪可以开始播放时运行的脚本。event-
on-playing当媒介已开始播放时运行的脚本。event-
on-progress当浏览器正在获取媒介数据时运行的脚本。event-
on-ratechange每当回放速率改变时运行的脚本(比如当用户切换到慢动作或快进模式)。event-
on-readystatechange每当就绪状态改变时运行的脚本(就绪状态监测媒介数据的状态)。event-
on-seeked当 seeking 属性设置为 false(指示定位已结束)时运行的脚本。event-
on-seeking当 seeking 属性设置为 true(指示定位是活动的)时运行的脚本。event-
on-stalled在浏览器不论何种原因未能取回媒介数据时运行的脚本。event-
on-suspend在媒介数据完全加载之前不论何种原因终止取回媒介数据时运行的脚本。event-
on-timeupdate当播放位置改变时(比如当用户快进到媒介中一个不同的位置时)运行的脚本。event-
on-volumechange每当音量改变时(包括将音量设置为静音)时运行的脚本。event-
on-waiting当媒介已停止播放但打算继续播放时(比如当媒介暂停已缓冲更多数据)运行脚本。event-
1.0.28

5 years ago

1.0.27

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago