Skip to content

Commit 7acfa7f

Browse files
committed
Add no-cookie option
1 parent bb093c8 commit 7acfa7f

File tree

7 files changed

+41
-181
lines changed

7 files changed

+41
-181
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,21 @@ createApp(App).use(VueYouTubeIframe).mount('#app');
4747
:video-id="YT_VIDEO_ID"
4848
:player-width="WIDTH"
4949
:player-height="HEIGHT"
50+
:no-cookie="TRUE / FALSE"
5051
:player-parameters="YT_PLAYER_PARAMS"
5152
@EVENT="CALLBACK"
5253
></youtube-iframe>
5354
</template>
5455
```
5556

57+
#### Available props
58+
59+
- `:videoId / :video-id`: Specify the YT video id (e.g. `dQw4w9WgXcQ`)
60+
- `:playerWidth / :player-width`: Specify the player's width in pixels
61+
- `:playerHeight / :player-height`: Specify the player's height in pixels
62+
- `:noCookie / :no-cookie`: If set to `true` the host will be set to `https://www.youtube-nocookie.com`
63+
- `:playerParameters / :player-parameters`: Set player parameters, see [here](#available-player-parameters)
64+
5665
#### Available player parameters
5766

5867
For the available player parameters see [here](https://developers.google.com/youtube/player_parameters#Parameters)

lib/vue-youtube-iframe.esm.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright © 2020-present Techassi
22
// Use of this source code is governed by a MIT-style
33
// license that can be found in the LICENSE file.
4-
// vue-youtube-iframe 1.0.1
4+
// vue-youtube-iframe 1.0.2
55
import { h, nextTick } from 'vue';
66

77
const manager = {
@@ -67,6 +67,10 @@ const player = {
6767
type: String,
6868
default: '',
6969
},
70+
noCookie: {
71+
type: Boolean,
72+
default: false,
73+
},
7074
},
7175
data() {
7276
return {
@@ -82,14 +86,18 @@ const player = {
8286
const { playerHeight, playerWidth, playerParameters, videoId } = this;
8387

8488
manager.register((factory, uid) => {
89+
const host = this.noCookie
90+
? 'https://www.youtube-nocookie.com'
91+
: 'https://www.youtube.com';
8592
this.elementId = uid;
93+
8694
nextTick().then(() => {
8795
this.player = new factory.Player(this.elementId, {
8896
width: playerWidth,
8997
height: playerHeight,
9098
...playerParameters,
9199
videoId,
92-
host: 'https://www.youtube.com',
100+
host,
93101
events: {
94102
onReady: (event) => {
95103
const p = event.target;

lib/vue-youtube-iframe.umd.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright © 2020-present Techassi
22
// Use of this source code is governed by a MIT-style
33
// license that can be found in the LICENSE file.
4-
// vue-youtube-iframe 1.0.1
4+
// vue-youtube-iframe 1.0.2
55
(function (global, factory) {
66
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
77
typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
@@ -71,6 +71,10 @@
7171
type: String,
7272
default: '',
7373
},
74+
noCookie: {
75+
type: Boolean,
76+
default: false,
77+
},
7478
},
7579
data() {
7680
return {
@@ -86,14 +90,18 @@
8690
const { playerHeight, playerWidth, playerParameters, videoId } = this;
8791

8892
manager.register((factory, uid) => {
93+
const host = this.noCookie
94+
? 'https://www.youtube-nocookie.com'
95+
: 'https://www.youtube.com';
8996
this.elementId = uid;
97+
9098
vue.nextTick().then(() => {
9199
this.player = new factory.Player(this.elementId, {
92100
width: playerWidth,
93101
height: playerHeight,
94102
...playerParameters,
95103
videoId,
96-
host: 'https://www.youtube.com',
104+
host,
97105
events: {
98106
onReady: (event) => {
99107
const p = event.target;

package-lock.json

Lines changed: 2 additions & 171 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@techassi/vue-youtube-iframe",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "This plugin makes it easy to integrate the YouTube Iframe API into your Vue app. This plugin is Vue V3 compatible.",
55
"main": "lib/vue-youtube-iframe.umd.js",
66
"module": "lib/vue-youtube-iframe.esm.js",
@@ -31,7 +31,6 @@
3131
"vue": "^3.0.0"
3232
},
3333
"devDependencies": {
34-
"@rollup/plugin-buble": "^0.21.3",
3534
"eslint": "^7.10.0",
3635
"eslint-config-airbnb-base": "^14.2.0",
3736
"eslint-config-prettier": "^6.12.0",

rollup.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// import buble from '@rollup/plugin-buble';
2-
31
const { version } = require('./package.json');
42

53
const banner = `// Copyright © ${new Date().getFullYear()}-present Techassi
@@ -29,5 +27,4 @@ export default {
2927
},
3028
},
3129
],
32-
// plugins: [buble()],
3330
};

0 commit comments

Comments
 (0)