Plyr: Hide controls at the beginning and show them after the video started.

Created on 22 Dec 2018  路  4Comments  路  Source: sampotts/plyr

I want the player to only show the ['play-large'] when the video is not played and then ['play-large', 'play', 'volume', 'fullscreen', 'progress'] if the video is playing. So just like youtube does it (big play button in the middle and if the user clicks on that and the video plays, then the other controls are shown).
How can I archive that?

I could not find any setters for the controls.

So something like:

const player = new Plyr('#player', {
    controls: ['play-large'],
});
player.on('play', event => {
    player.controls = ['play-large', 'play', 'volume', 'fullscreen', 'progress'];
});

Most helpful comment

This is (at least partially) address by #1115, the resolution being adding a class connected to .plyr.plyr--stopped such as:

.plyr.plyr--stopped .plyr__controls { display: none }

This would hide everything but the play button, for example. Using this method you could hide anything you wish. Though I agree that this should be a config option.

Actually the above code hides the audio player completely. Had a hard time to figure out why the audio player was not appearing due to this. So this one would be better:

.plyr--video.plyr--stopped .plyr__controls { display: none; }

All 4 comments

joining to this request.
its very annoying to see the controls show on player load, then hide and show again when video starts to play.

This is (at least partially) address by #1115, the resolution being adding a class connected to .plyr.plyr--stopped such as:
css .plyr.plyr--stopped .plyr__controls { display: none }
This would hide everything but the play button, for example. Using this method you could hide anything you wish. Though I agree that this should be a config option.

Thanks for that, I also like the CSS approach

This is (at least partially) address by #1115, the resolution being adding a class connected to .plyr.plyr--stopped such as:

.plyr.plyr--stopped .plyr__controls { display: none }

This would hide everything but the play button, for example. Using this method you could hide anything you wish. Though I agree that this should be a config option.

Actually the above code hides the audio player completely. Had a hard time to figure out why the audio player was not appearing due to this. So this one would be better:

.plyr--video.plyr--stopped .plyr__controls { display: none; }

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zsavajji picture Zsavajji  路  3Comments

frumbert picture frumbert  路  3Comments

michaelmano picture michaelmano  路  3Comments

nam-co picture nam-co  路  4Comments

MTyson picture MTyson  路  3Comments