36 lines
963 B
JavaScript
36 lines
963 B
JavaScript
export default () => {
|
|
return {
|
|
show: false,
|
|
player: false,
|
|
init() {
|
|
// this.open();
|
|
},
|
|
open() {
|
|
if (this.player) {
|
|
this.show = true;
|
|
this.player.play();
|
|
} else {
|
|
const player = (new Plyr("#trailer", {
|
|
autoplay: true,
|
|
youtube: {
|
|
noCookie: false,
|
|
rel: 0,
|
|
showinfo: 0,
|
|
iv_load_policy: 3,
|
|
modestbranding: 1,
|
|
},
|
|
}).on("ready", (ev) => {
|
|
this.player = ev.detail.plyr;
|
|
this.show = true;
|
|
}));
|
|
}
|
|
},
|
|
close() {
|
|
this.player.pause();
|
|
this.show = false;
|
|
},
|
|
isOpen() {
|
|
return this.show === true;
|
|
},
|
|
};
|
|
};
|