Monday 28 January 2019

Prevent video pause when clicking on progress bar - Youtube Iframe API

I am trying to hide related videos that shows up when you pause a video but as I found out from similar questions that as of September 25th 2018 there is no way to disable the related videos from displaying.

The effect of the change is that you will not be able to disable related videos. However, you will have the option of specifying that the related videos shown in the player should be from the same channel as the video that was just played.

To be more specific:

Prior to the change, if the parameter's value is set to 0, then the player does not show related videos. After the change, if the rel parameter is set to 0, the player will show related videos that are from the same channel as the video that was just played.

So I have created an overlay that shows the thumbnail of the same video when you click on pause to hide the related videos with event.data == YT.PlayerState.PAUSED

So far it works but the event.data == YT.PlayerState.PAUSED is also getting fired when you use the seek bar / progress bar which makes the overlay to appear, which it shouldn't. It does not happen when you use your arrow keys to forward or rewind the video. Here is the JSFiddle.

Also the parameter showinfo=0 dosen't work anymore which was used to hide the video title, watch later button and the share button. It is deprecated as of September 25, 2018 but somehow KhanAcademy is still able to hide those including the related videos. Are they using a different API?

Hiding the related videos altogether like Khan Academy does or overlaying a thumbnail on top to hide the related videos will work for me.



from Prevent video pause when clicking on progress bar - Youtube Iframe API

No comments:

Post a Comment