Video.js: First frame as poster?

Created on 11 Jan 2013  Â·  13Comments  Â·  Source: videojs/video.js

Is it possible (could you add this possibility)?

question

Most helpful comment

Or add preload='metadata' to load only metadata when the page loads

All 13 comments

Don't set a poster, and set preload="auto". In most browsers that should show the first frame of the video.

On Jan 11, 2013, at 12:11 AM, Alexander Sidorov [email protected] wrote:

Is it possible (could you add this possibility)?

—
Reply to this email directly or view it on GitHub.

Yep - this works great. Note that another alternative is to grab an ffmpeg library and take a snapshot from the beginning of the video. Above approach is much preferred though.

Hi,
I tried this method but the poster is coming up a black screen.
This is how I have it set:

@theshine do you have more of the embed code? What type of video are you using? I'm not certain whether our flash fallback can do this. If you're using html it should work.

Also, what version of videojs and what browser did you use?

Hi,
Thanks for the help.
This is the final page:
http://thediamond.com/fancybox/vimeotestjs5.html
Its an mp4 file.

I am trying it on IE, chrome and FF.
Thanks

Is it working on safari and iOS without using poster attribute?

Not working on iOs w/Chrome.

Or add preload='metadata' to load only metadata when the page loads

@gkatsev Hi!
I use videojs 7.4.1
The player does not put the first frame as poster IF src is .m3u8, with .mp4 works well.

For future googlers:

function setPoster(player) {
  player.muted(true);

  player.play().then(function(){
    player.pause();
    player.hasStarted(false);
    player.removeClass('btn-hide');

    player.one('play', function(){
      this.muted(false)
    })
  })
}

do not forget to add to your video elem some class like my btn-hide, which hides play button, control panel and spinner. And update css with

.btn-hide .vjs-big-play-button,
.btn-hide .vjs-loading-spinner,
.btn-hide .vjs-control-bar {
  display: none;
}

thanks @Kogoruhn , but browsers stop autoplay these days :(

edit: So that should actually work just fine. It seems firefox has a bug with that though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

victorpfm picture victorpfm  Â·  4Comments

SolmazKh picture SolmazKh  Â·  4Comments

0xsven picture 0xsven  Â·  3Comments

zhulduz picture zhulduz  Â·  3Comments

gfviegas picture gfviegas  Â·  3Comments