Skip to content

Commit

Permalink
Merge pull request #43 from teaualune/feature/paused-event
Browse files Browse the repository at this point in the history
Add paused event
  • Loading branch information
pmochine authored Dec 15, 2024
2 parents 7796a5b + a0ebfb3 commit 70764bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ You can add your own transition styles here. If you set it to empty string, it w

- `ready`: Video is loaded
- `playing`: Video is playing
- `paused`: Video is paused
- `error`: Video error
- `loading`: Video is loading
- `ended`: Video finished, only when `loop` is set to false
Expand All @@ -190,11 +191,11 @@ You can add your own transition styles here. If you set it to empty string, it w

If you happen to need more control over the player, you can use the internal methods. For that, you need to set `ref=videobackground` to the HTML tag `<video-background>`. After that you can call all methods like this `this.$refs.videobackground.player.play()`.

- `play()`: Video is playing
- `pause()`: Video is paused
- `show()`: Video is shown
- `hide()`: Video is hidden, the poster is shown
- `load()`: Video is loaded
- `play()`: Plays the video
- `pause()`: Pauses the video
- `show()`: Shows the video
- `hide()`: hides the video and the poster will be shown
- `load()`: Loads the video


## Security
Expand Down
3 changes: 2 additions & 1 deletion src/VideoBackground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
:object-fit="objectFit"
@ready="playVideo"
@playing="$emit('playing')"
@paused="$emit('paused')"
@error="$emit('error')"
@loading="$emit('loading')"
@ended="$emit('ended')"
Expand Down Expand Up @@ -47,7 +48,7 @@ import resize from './core/resize';
export default {
props,
mixins: [resize],
emits: ['playing', 'error', 'loading', 'ended', 'ready'],
emits: ['playing', 'paused', 'error', 'loading', 'ended', 'ready'],
components: {
VideoPlayer,
VideoPoster,
Expand Down
3 changes: 2 additions & 1 deletion src/components/VideoPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import props from '../core/playerProps';
export default {
props,
emits: ['playing', 'error', 'loading', 'ended', 'ready'],
emits: ['playing', 'paused', 'error', 'loading', 'ended', 'ready'],
data() {
return {
showVideo: false,
Expand All @@ -52,6 +52,7 @@ export default {
pause() {
if (this.$refs.video) {
this.$refs.video.pause();
this.$emit('paused');
}
},
load() {
Expand Down

0 comments on commit 70764bb

Please sign in to comment.