0

How to Embed youtube video on your website with custom controls

If you have attached a youtube video in your website/blog and you want custom control for youtube player like auto play,youtube logo,conceal video controls and some more then this post is for you guys.

Step:1- Create html page with player div container.

Step:2- Loads the IFrame Player API code asynchronously

Step:3- Below function creates an iframe (and YouTube player) after the API code downloads.

Don’t forget to add youtube video id, you can get from youtube site while playing video copy id from url like https://www.youtube.com/watch?v=Gp3N5wUEz_I in this url youtube id is Gp3N5wUEz_I

Step:4- In the events method you can create player’s events like onReady, onStateChange etc.
onReady: The API will call this function when the video player is ready.
onPlayerStateChange: The API calls this function when the player’s state changes

Complete code..

Leave a Reply

Your email address will not be published. Required fields are marked *