Skip to content

Commit

Permalink
Added playbackRate
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp committed Mar 31, 2020
1 parent 8c06004 commit 2b5ca48
Show file tree
Hide file tree
Showing 11 changed files with 1,286 additions and 653 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ So the video fits perfectly in the container

This is important, if you know that you might have users with bad internet speed, you should definetly use `canplaythrough`. Learn more in [video events](https://www.w3schools.com/tags/ref_av_dom.asp).

- `playbackRate` (default: `1.0`)

The playbackRate property sets the current playback speed of the video. [Example](https://www.w3schools.com/jsref/prop_video_playbackrate.asp) but negative values didn't work for me?

## Events

- `ready`: Video is loaded
Expand Down
2 changes: 1 addition & 1 deletion demo/public/js/app.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions dist/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<meta charset="utf-8">
<title>index demo</title>
<script src="./index.umd.js"></script>


<script>
console.log(index)
</script>
388 changes: 301 additions & 87 deletions dist/index.common.js

Large diffs are not rendered by default.

388 changes: 301 additions & 87 deletions dist/index.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.umd.min.js

Large diffs are not rendered by default.

1,134 changes: 658 additions & 476 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "vue-responsive-video-background-player",
"version": "1.0.8",
"version": "1.1.0",
"description": "Play your own videos in background responsively",
"main": "dist/index.common.js",
"unpkg": "dist/index.umd.min.js",
"private": false,
"scripts": {
"demo": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"build": "vue-cli-service build",
"build-bundle": "vue-cli-service build --target lib --name index ./src/index.js"
},
Expand Down
1 change: 1 addition & 0 deletions src/VideoBackground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
:loop="loop"
:preload="preload"
:plays-when="playsWhen"
:playback-rate="playbackRate"
@ready="playVideo"
@playing="$emit('playing')"
@error="$emit('error')"
Expand Down
5 changes: 5 additions & 0 deletions src/components/VideoPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default {
}, 1000);
},
play() {
this.setPlaybackRate();
this.$refs.video.play();
this.show();
this.$emit('playing');
Expand Down Expand Up @@ -91,6 +92,10 @@ export default {
videoEnded() {
this.$emit('ended');
},
setPlaybackRate() {
this.$refs.video.playbackRate = this.playbackRate;
this.$refs.video.defaultPlaybackRate = this.playbackRate;
},
},
mounted() {
if (this.videoCanPlay()) {
Expand Down
4 changes: 4 additions & 0 deletions src/core/playerProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ export default {
default: 'canplay',
note: 'Google HTML Video Events',
},
playbackRate: {
type: Number,
default: 1.0,
},
};

0 comments on commit 2b5ca48

Please sign in to comment.