How to remove related videos when using YT.Player for embedding YouTube videos

Today while working on MEDinar we had a problem with our presentation videos. We are using YouTube to host it. But when our customer finishes watching, they are suggested related videos. All of them were not related plus it’s not good for them to get distracted. The video is about how MEDinar is awesome and not some cat videos.

We are using YT.Player to embed video.

The reason is why we are using this way is to also track events when usre pauses and completes watching videos.

Many solutions on the internet suggested to specify additional parameter rel=0 to end of the URL. But how to do this with YT.Player? We needed to check official Google documentation By adding additional parameter in YT.Player initialization, we were able to remove related videos. The final code is.

Simple, right?