
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
nuxt-lazytube
Advanced tools
Support for Nuxt 3
Embed a YouTube or Vimeo player easily and lazy load the video to save resources and reduces initial load size. Useful when performance and page size is important or for sites with many embedded videos.
For a simple example page with 10 videos, nuxt-lazytube will reduce loadtime by 7x and memory usage by 2-3x.
props
play
, stop
, pause
and reset
) embedded videosnuxt-lazytube for Nuxt3 applications.
$ npx nuxi@latest module add nuxt-lazytube
nuxt.config.js
{
modules: [
'nuxt-lazytube',
]
},
<template>
<!-- Youtube Embed -->
<LazyYoutube src="https://www.youtube.com/watch?v=TcMBFSGVi1c"/>
<!-- Vimeo Embed -->
<LazyVimeo src="https://player.vimeo.com/video/64654583"/>
</template>
Name | Type | Default Value | Description | Required |
---|---|---|---|---|
src | String | `` | To load the video and iframe, the link must be from YouTube or Vimeo. Any additional query parameters in the URL will be automatically included. | true |
aspectRatio | String | 16:9 | Maintaining the aspect ratio of video, perfect for responsively handling video embeds based on the width of the parent, should be in *:* format. e.g, 1:1 , 4:3 , 16:9 and 21:9 . | false |
maxWidth | String | 560px | Defines maximum width of video container. | false |
showTitle | Boolean | true | Defines whether to show video title on top. | false |
autoplay | Boolean | false | Defines whether to load the iframe as the page loads (not recommended) | false |
thumbnailQuality | String | standard | Defines the quality of thumbnail, should be one of the following default , medium , high , standard or maxres | false |
iframeClass | String | ly-iframe | Defines the class on iframe element | false |
customTitle | String | `` | Defines the custom title of the video | false |
customThumbnail | String | `` | Defines the custom thumbnail image link of the video | false |
iframePolicy | String | `` | Define iframe in COEP environments ['anonymous' or 'credentialless']. | false |
This Component provides some slots. You can use the named slot to render custom play button and loader:
Slot | Description |
---|---|
button | Slot gives an ability to provide custom play button |
loader | Slot gives an ability to provide custom loader |
These methods let you control the player using JavaScript, so you can perform the operations
like play
, stop
, pause
and reset
.
The user's browser must support the HTML5 postMessage feature. Most modern browsers support postMessage.
Name | Type | Usage |
---|---|---|
playVideo | function | this.$refs["lazyVideo"]['playVideo']() |
stopVideo | function | this.$refs["lazyVideo"]['stopVideo']() |
pauseVideo | function | this.$refs["lazyVideo"]['pauseVideo']() |
resetView | function | this.$refs["lazyVideo"]['resetView']() |
Note: Must Replace lazyVideo
with your ref.
<script setup>
const lazyVideo = ref()
const handleClick = (event) => {
lazyVideo.value[event]()
}
</script>
<template>
<div>
<LazyYoutube
ref="lazyVideo"
src="https://www.youtube.com/embed/KfYkzXTut1Y"
/>
<button @click="handleClick('playVideo')">Play</button>
<button @click="handleClick('stopVideo')"> Stop</button>
<button @click="handleClick('pauseVideo')"> Pause</button>
<button @click="handleClick('resetView')"> Reset</button>
</div>
</template>
FAQs
Nuxt.js 3 nuxt-lazytube
The npm package nuxt-lazytube receives a total of 222 weekly downloads. As such, nuxt-lazytube popularity was classified as not popular.
We found that nuxt-lazytube demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.