1.1.3 • Published 4 years ago

vue-frame-video v1.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

vue-frame-video

alpha test

attribute

attributetypedefaultdescription
srcStringvideo URI
controlsBooleanfalsedefault video UI
autoplayBooleanfalseautoplay
mutedBooleanfalseMute
loopBooleanfalseloop
initail-timeNumber0initial time (seconds)
playeventhandleFires the play event when starting/continuing playback
pauseeventhandleFires the pause event when paused
timeupdateeventhandleTriggered when the playback progress changes {currentTime, duration}
fullscreenchangeeventhandleTriggered when the video enters fullscreen or exits full screen {fullScreen}
waitingeventhandleTriggered when video buffering
erroreventhandleTriggered when video playback error occurs{ret,msg}
progresseventhandleTriggered when loading progress changes {buffered}, %
frameupdateeventhandleTriggered when the playback frame changes {SMPTE}(hh:mm:ss:ff)

method

methodtypereturndescription
play()Play and resume
pause()Pause
currentTime(Seconds)(Number)(Number)Get the current playback time point, or set the playback time point, which cannot exceed the video duration
duration()(Number)Get video duration
volume(percent)(Number)0,1/nullNumber
requestFullscreen()enter fullscreen
exitFullscreen()exit fullscreen
isFullscreen()BooleanReturns whether video has entered full screen
on(type,listerner)(String, Function)Listening event
one(type,listerner)(String, Function)Listening event, event handlers are only executed at most once
off(type,listerner)(String, Function)Unbind event listener
buffered()TimeRangesreturn TimeRanges of video buffers
bufferedPercent()0,1Returns the buffer length as a percentage of the video duration
dispose()Destroy the player
seekForward()seekForward one Frame
seekBackward()seekBackward one Frame
captureIMG(width,height,scale)(width:Number viedeoWidth if pass null,height:Number viedeoHeight if pass null,scale default 1)

example

<template>
  <div id="app">
    <div>
      <FrameVideo
        ref="videoElement"
        :src="src"
        :initialTime="initialTime"
        :autoplay="autoplay"
        @play="onPlay"
        @pause="onPause"
        @ended="onEnded"
        @waiting="onWaiting"
        @progress="onProgress"
        @error="onError"
        @timeupdate="onTimeupdate"
        @frameupdate="onFrameupdate"
      />
    </div>
    <div>{{ SMPTE }}</div>
    <button v-on:click="play">play</button>
    <button v-on:click="pause">pause</button>
    <button v-on:click="seekTest">seekTest</button>
    <button v-on:click="seekForward">seekForward</button>
    <button v-on:click="seekBackward">seekBackward</button>
  </div>
</template>

<script>
import FrameVideo from "vue-frame-video";
var video;

export default {
  name: "app",
  components: {
    FrameVideo
  },
  mounted: function() {
    video = this.$refs.videoElement;
  },
  data() {
    return {
      src:
        "your video",
      initialTime: 0,
      autoplay: false,
      SMPTE:"00:00:00:00"
    };
  },
  methods: {
    play: function() {
      video.play();
    },
    pause: function() {
      video.pause();
    },
    seekForward: function() {
      video.seekForward();
    },
    seekBackward: function() {
      video.seekBackward();
    },
    onPlay: function(){
      console.log('onPlay');
    },
    onPause:function(){
      console.log('onPause');
    },
    onEnded:function(){
      console.log('onEnded');
    },
    onWaiting:function(){
      console.log('onWaiting');
    },
    onFullscreenchange: function(event) {
      console.log('onFullscreenchange');
    },
    onTimeupdate: function(event) {
      console.log('onTimeupdate',event);
    },
    onFrameupdate: function(event) {
      this.SMPTE = event.SMPTE
    },
    onProgress: function(event){
      console.log('onProgress',event);
    },
    onError: function(event){
      console.log('onError',event);
    }
  }
};
</script>

<style>
</style>
1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

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