|
5 | 5 | (function (global, factory) { |
6 | 6 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) : |
7 | 7 | typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) : |
8 | | - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VueYouTubeEmbed = {}, global.vue)); |
| 8 | + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VueYoutubeIframe = {}, global.vue)); |
9 | 9 | }(this, (function (exports, vue) { 'use strict'; |
10 | 10 |
|
11 | 11 | function createManager() { |
|
45 | 45 | } |
46 | 46 | const manager = createManager(); |
47 | 47 |
|
48 | | - /** |
49 | | - * seekIfAutoplay seeks to the provided timestamp if autoplay is enabled |
50 | | - * @param player The player instance |
51 | | - * @param playerVars The player vars |
52 | | - */ |
53 | 48 | function seekIfAutoplay(player, playerVars) { |
| 49 | + console.log(YT); |
54 | 50 | if (playerVars.autoplay != undefined && playerVars.autoplay == YT.AutoPlay.AutoPlay) { |
55 | 51 | player.mute(); |
56 | 52 | if (playerVars.start != undefined && playerVars.start != 0) { |
|
97 | 93 | }; |
98 | 94 | }, |
99 | 95 | render() { |
100 | | - return vue.h('div', [vue.h('div', { id: this.elementId })]); |
| 96 | + return vue.h('div', { class: ['vue-youtube-iframe'] }, [vue.h('div', { id: this.elementId })]); |
101 | 97 | }, |
102 | | - template: '<div><div :id="elementId"></div></div>', |
| 98 | + template: '<div class="vue-youtube-iframe"><div :id="elementId"></div></div>', |
103 | 99 | methods: { |
104 | 100 | cueVideoById(videoId, startSeconds, suggestedQuality) { |
105 | 101 | this.player.cueVideoById(videoId, startSeconds, suggestedQuality); |
|
248 | 244 | return new factory.Player(id, options); |
249 | 245 | } |
250 | 246 |
|
251 | | - const plugin = { |
252 | | - install: (app) => { |
253 | | - if (typeof window !== 'undefined' && typeof document !== 'undefined') { |
254 | | - const tag = document.createElement('script'); |
255 | | - tag.src = 'https://www.youtube.com/player_api'; |
256 | | - const firstScriptTag = document.getElementsByTagName('script')[0]; |
257 | | - if (firstScriptTag.parentNode != null) { |
258 | | - firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); |
259 | | - app.component('youtube-iframe', player); |
260 | | - window.onYouTubeIframeAPIReady = () => { |
261 | | - manager.registerFactory(window.YT); |
262 | | - manager.registerEvents(); |
263 | | - manager.runBacklog(); |
264 | | - }; |
265 | | - } |
| 247 | + const install = (app) => { |
| 248 | + if (typeof window !== 'undefined' && typeof document !== 'undefined') { |
| 249 | + const tag = document.createElement('script'); |
| 250 | + tag.src = 'https://www.youtube.com/player_api'; |
| 251 | + console.log('New TS Version'); |
| 252 | + const firstScriptTag = document.getElementsByTagName('script')[0]; |
| 253 | + if (firstScriptTag.parentNode != null) { |
| 254 | + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); |
| 255 | + app.component('youtube-iframe', player); |
| 256 | + window.onYouTubeIframeAPIReady = () => { |
| 257 | + console.log(typeof window.YT); |
| 258 | + manager.registerFactory(window.YT); |
| 259 | + manager.registerEvents(); |
| 260 | + manager.runBacklog(); |
| 261 | + }; |
266 | 262 | } |
267 | | - }, |
| 263 | + } |
| 264 | + }; |
| 265 | + const plugin = { |
| 266 | + install, |
268 | 267 | }; |
269 | 268 |
|
270 | 269 | exports.YouTubePlayer = player; |
|
0 commit comments