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

Problems with using v-slot:button #24

Open
MarinAlieva opened this issue Jun 6, 2022 · 1 comment
Open

Problems with using v-slot:button #24

MarinAlieva opened this issue Jun 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@MarinAlieva
Copy link

Hello, I have a problem when I use v-slot:button.

this is how i use v-slot:button:

    <LazyYoutube
        ref="youtubeLazyVideo"
        :src="youtubeLink"
        max-width="720px"
        aspect-ratio="16:9"
        thumbnail-quality="standard"
        :loop=true
        :autoplay=false
    >

      <template v-slot:button>
        <button @click="handleClick('playVideo', 'youtubeLazyVideo')">Play</button>
      </template>
    </LazyYoutube>

My button plays a video when clicked, but at the same time two identical iframes are created, this causes some problems.

Adding this condition helped me: this.iframeEl === null
in the LazyYoutube.vue file in the handleClick() method

    handleClick() {
      this.clicked = true;
      if (this.fetchingInfo === false && !this.onceLoaded && this.isVideoFound) {
        if (this.iframeEl === null) {
          this.initiateIframe(this.autoplay, this.loop);
        }
      }
    },

But I don't know how correct this is. And I would not want to change the library code myself.

@seeratawan01
Copy link
Owner

Thank you @MarinAlieva for pointing it out, I will look into it

@seeratawan01 seeratawan01 added the bug Something isn't working label Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants