DEV Community

Shivali Pandey
Shivali Pandey

Posted on

Need help in embedding YouTube videos without using Iframe in Vue.js. Any Suggestions?

Top comments (6)

Collapse
 
danilo profile image
Danilo César

Hi, Shivali! These solutions below are framework-agnostic, so I think you'll be fine using them along with Vue.js for your project.

In fact, you don't need to use a iframe for embedding a YouTube video. You can either use: (a) the <embed> or <object> HTML tags, as described here; (b) the YouTube API, by creating a solution yourself, explained here; or (c) using a third-party library that already does it for you, such as plyr (there is also a Vue component for it), that you can customize according to your project requirements.

Collapse
 
ajshivali profile image
Shivali Pandey

Thanks a lot

Collapse
 
danilo profile image
Danilo César

No problem! 😄

Collapse
 
10shubham01 profile image
10shubham01

Hey, you can use vue-youtube. its easy to implement and its provide some events and props so that you can customise the player as per your requirement.
npmjs.com/package/vue-youtube

Collapse
 
ajshivali profile image
Shivali Pandey

Thanks a lot @@10shubham01

Collapse
 
10shubham01 profile image
10shubham01

😊