Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add embedConfig props. #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/vue-youtube-embed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Vue YouTube Embed version 2.2.2
* under MIT License copyright 2019 kaorun343
* under MIT License copyright 2020 kaorun343
*/
// fork from https://github.com/brandly/angular-youtube-embed

Expand Down Expand Up @@ -112,6 +112,10 @@ var YouTubePlayer = {
type: Object,
default: function () { return ({ autoplay: 0, time: 0 }); }
},
embedConfig: {
type: Object,
default: function () { return ({}); }
},
videoId: {
type: String
},
Expand Down Expand Up @@ -173,13 +177,15 @@ var YouTubePlayer = {
var playerHeight = ref.playerHeight;
var playerWidth = ref.playerWidth;
var playerVars = ref.playerVars;
var embedConfig = ref.embedConfig;
var videoId = ref.videoId;
var host = ref.host;

this$1.player = new YouTube.Player(this$1.elementId, {
height: playerHeight,
width: playerWidth,
playerVars: playerVars,
embedConfig: embedConfig,
videoId: videoId,
host: host,
events: {
Expand Down
8 changes: 7 additions & 1 deletion lib/vue-youtube-embed.umd.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Vue YouTube Embed version 2.2.2
* under MIT License copyright 2019 kaorun343
* under MIT License copyright 2020 kaorun343
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
Expand Down Expand Up @@ -118,6 +118,10 @@
type: Object,
default: function () { return ({ autoplay: 0, time: 0 }); }
},
embedConfig: {
type: Object,
default: function () { return ({}); }
},
videoId: {
type: String
},
Expand Down Expand Up @@ -179,13 +183,15 @@
var playerHeight = ref.playerHeight;
var playerWidth = ref.playerWidth;
var playerVars = ref.playerVars;
var embedConfig = ref.embedConfig;
var videoId = ref.videoId;
var host = ref.host;

this$1.player = new YouTube.Player(this$1.elementId, {
height: playerHeight,
width: playerWidth,
playerVars: playerVars,
embedConfig: embedConfig,
videoId: videoId,
host: host,
events: {
Expand Down
34 changes: 34 additions & 0 deletions play/embedConfig.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<template lang="html">
<container :title="title">
<h2>EmbedConfig</h2>
<youtube video-id="M7lc1UVf-VE" :embedConfig="embedConfig"></youtube>
</container>
</template>

<script>
import container from './container.vue'

export default {
data () {
return {
title: 'Player Vars',
player1: {
autoplay: 1
},
embedConfig: {
relatedVideos: ['xxxxx', 'xxxxx'],
adsConfig: {
adTagParameters: {
iu: `xxxxxx`,
},
nonPersonalizedAd: true,
},
}
}
},
components: { container }
}
</script>

<style lang="css">
</style>
2 changes: 2 additions & 0 deletions play/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import PlayerVars from './PlayerVars.vue'
import UpdateVideoId from './UpdateVideoId.vue'
import List from './List.vue'
import Volume from './Volume.vue'
import EmbedConfig from './EmbedConfig.vue'

play('Vue YouTube Embed', module)
.add('Events', Events)
.add('Height and Width', Size)
.add('Player Vars', PlayerVars)
.add('EmbedConfig', EmbedConfig)
.add('Update Video ID', UpdateVideoId)
.add('List', List)
.add('Volume', Volume)
7 changes: 6 additions & 1 deletion src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export default {
type: Object,
default: () => ({ autoplay: 0, time: 0 })
},
embedConfig: {
type: Object,
default: () => ({})
},
videoId: {
type: String
},
Expand Down Expand Up @@ -72,12 +76,13 @@ export default {
},
mounted () {
container.register((YouTube) => {
const { playerHeight, playerWidth, playerVars, videoId, host } = this
const { playerHeight, playerWidth, playerVars, embedConfig, videoId, host } = this

this.player = new YouTube.Player(this.elementId, {
height: playerHeight,
width: playerWidth,
playerVars,
embedConfig,
videoId,
host,
events: {
Expand Down
Loading