feross/yt-player

Make yt-player responsive by default

cksachdev opened this issue · 2 comments

I have been experimenting with iframe and haven't figured out a proper solution to make it responsive, so in mobile devices, player takes the full width. Is this something you are focusing for this library?

IMHO, this is the most common scenario and in seekTo method, if I don't set the boolean flag, video keeps on buffering and doesn't play at all.

To make the player responsive, try this:

const player = new YTPlayer(elem, {
  width: '100%',
  height: '100%'
})

This will make the player expand to the full size of the container element that the player element is contained within.

As for the seekTo method, I just removed the param so it always seeks instantly now. Update the version of the yt-player and test again.