How to get HTML5 video thumbnail without using poster on safari or iOS?

html5 video poster not showing safari
html5 video poster image not showing iphone
safari ios video poster
html5 video generate poster image
html video thumbnail first frame
iframe video thumbnail html
html5 video jump to time
html video automatic poster

I have embedded HTML5 video with mp4 format. How to get thumbnail image like poster without using "poster" attribute. This problem coming on Safari and iOS. I have added video like below mentioned code.

<video height=350 id='TestVideo' webkit-playsinline><source src='test.mp4' type=video/mp4></video>

On Chrome, IE, Firefox first frame of video coming as thumbnail image, but not coming on Safari and iOS.

simply add preload="metadata" in video tag and set #t=0.1 at url src, it will get the frame of 0.1s of your video as thumbnail

however, the disadvantage of this solution is when you click to play the video, it always start at 0.1s

<video preload="metadata" controls>
    <source src="video.mp4#t=0.1" type="video/mp4">

How to get HTML5 video thumbnail without using poster - iOS, I have embedded HTML5 video with mp4 format. How to get thumbnail image like poster without using "poster" attribute. This problem coming on Safari and iOS. There are a few things wrong with the above code. Not sure how the poster was able to even run this. But you need to get a better name for the file you will be saving. Line:54. As this grabs the entire url for the video and then sends that off as the file name. I would suggest stripping the last 4 lines of the videos[index-1] at the same place.

If you want to do this without storing server side images it is possible, though a bit clunky... uses a canvas to record the first frame of the video and then overlay that over the video element. It may be possible to use the URL for the Canvas as a source for the Poster (eg video.poster = c.toDataURL();) but that requires correct CORS setup (not sure if the video was on your own server, and if you have control over that, so took the safest option). This will work best if video is correctly encoded for streaming (so MOOV atom is at the front of the video, otherwise it will be slow to draw the overlay - see this answer for more detail)

The HEAD contains styling for the video and the overlay (you will need to adjust sizing and position to suit your application)

    #video_overlays {
      background-color: #000000;

In the BODY you will need the div for the overlay and the video. The overlay div has an onclick handler to hide the overlay and start the video playing

<div id="video_box">
  <div id="video_overlays" onclick="'none';document.getElementById('video').play()"></div>

    <video id="video" controls width="640" height="264">
      <source src="BigBuck.mp4" type='video/mp4'>


Finally you will need code that will load the video, seek to the first frame and load the visual into a canvas that you then insert into the overlay


function generateOverlay() {
    video.removeEventListener('seeked',generateOverlay);  / tidy up the event handler so it doesn't redraw the overlay every time the user manually seeks the video
    var c = document.createElement("canvas");
    var ctx = c.getContext("2d");
    c.width = 640;
    c.height = 264;
    ctx.drawImage(video, 0, 0, 640, 264); // take the content of the video frame and place in canvas
    overlay.appendChild(c); // insert canvas into the overlay div

    // identify the video and the overlay
    var video = document.getElementById("video");
    var overlay = document.getElementById("video_overlays");

    // add a handler that when the metadata for the video is loaded it then seeks to the first frame
    video.addEventListener('loadeddata', function() {
        this.currentTime = 0;
    }, false);

    // add a handler that when correctly seeked, it generated the overlay
    video.addEventListener('seeked', function() {
    // now video has seeked and current frames will show
    // at the time as we expect
    }, false);

    // load the video, which will trigger the event handlers in turn


No poster image on mobile � Issue #889 � videojs/video.js � GitHub, The issue I'm currently browser testing a website on which I use on android and iOS and instead shows the default os player. HTML. @heff Not sure about javascript error since I don't have a JS console when testing mobile phones. I' ve found on iOS Safari that if I clear the browser cache and reload� I'm a member because the Drupal Association provides spaces where the community can come together and focus on what matters— connecting with each other and making Drupal a more inclusive project for all.

Source: How to set the thumbnail image on HTML5 video?

This worked for me:

<img src="thumbnail.png" alt="thumbnail" />
/* code for the video goes here */

Now using jQuery play the video and hide the image as

$("img").on("click", function() {
  // play the video now..

Hack for iOS Safari to display the HTML video thumbnail � Muffin Man, No comments. Mobile iOS Safari doesn't display preview thumbnail until you tap on the video. My go-to solution was to define a poster attribute� Show a video poster or thumbnail before the video is started. If the video is not played automatically it’s a good idea to show a video thumbnail and thus give viewers a glimpse of the content. For the video to have a poster you simply need to add the poster attribute and the URL to the poster image:

this is a bit late but we had the same scenario. I can't use the attribute 'muted' because my videos are podcasts. This is what I came up with and I hope to share it with future visitors. What I did is load the video in the body tag, drew a canvas, retrieved as base64 and applied to the video as the background image.

Since my video should be fixed 150px in height, I computed the aspect ratio so that whatever height and width of the actual video, it will be resized into 150px height and dynamic width.

$('body').append('<video class="checkmeload" style="position:absolute;top:-10000px" controls preload="auto" playsinline src="//src-here"><source src="//src-here" type="//videotype-here"></video>');

$('body').find('.checkmeload').on('loadeddata', function(){
    var video = $('.checkmeload');

    var canvas = document.createElement('canvas');
    aspectratio = (video[0].videoWidth / video[0].videoHeight);
    newwidth = (150 * aspectratio);
    canvas.width = newwidth;
    canvas.height = 150;

    var context = canvas.getContext('2d');
    context.drawImage(video[0], 0, 0, canvas.width, canvas.height);
    var dataURI = canvas.toDataURL('image/jpeg');


    $('#myvideo').css('background-image','url("'+dataURI +'")');

10 Advanced Features In The HTML5 <video> Player, Show a video poster or thumbnail before the video is started For the video to have a poster you simply need to add the poster attribute and the URL to the poster image: none – no preload is done; metadata – only the metadata is preloaded: Safari on iOS 10+ supports inline playback of videos. Use the <video> tag for inserting videos in HTML¶ The <video> tag is added in HTML5 along with its sibling, <audio>. Before the release of HTML5, a video could only be played in a browser with a plug-in (like a flash). The HTML5 <video> element specifies a standard way to embed a video in a web page.

Show Poster Image directly from Video – Ashish Panchal, By keeping poster image clear & from video will make user interested to click on In All Posts, HTMLTags html5, html5video, poster image, video January 9 To solve this without increasing any http request and having total When I use an iPad to test it no poster image or the frame indicated is displayed. In Safari 5.1 and later, you can choose any HTML element and expand it to fill the screen, allowing you to use your own custom controls while playing video in full-screen mode. At a Glance Safari supports the <video> and <audio> media elements on iOS 3.0 and later and in Safari 3.1 and later on the desktop (Mac OS X and Windows).

Poster-problem--HTML5 video and first frame in iOS 8 & 9, HTML5 video, iOS 8 & 9, poster This page used to display the first frame of a movie automatically in mobile Safari and iOS Chrome under iOS 7, but now in iOS 8 and iOS 9, there's just a play triangle -- no image! Now, in order to have a image display on iOS, you have to explicitly create a jpeg and then� HTML5 Video and Background Images « Back 19 March 2013. Stack Overflow can be a great place to get the mind going and this evening was no exception. A question was posted asking how to get a HTML5 video’s poster image to fill the element if its aspect ration differs. Firt off, let’s take a piece of straightforward code for embedding a

HTML5 video, The HTML5 specification introduced the video element for the purpose of playing videos, The optional "poster" attribute specifies an image to show in the video's place before since user agents have no minimal set of video and audio formats to support. "Safari 12.1 Release Notes | Apple Developer Documentation". The HTML <video> poster Attribute is used to display the image while video downloading or when user click the play button. If this image not set then it will take the first frame of video as a poster image. Syntax: <video poster="URL"> Attribute Values: It contains a single value URL which specifies the link of source image. There are two types

  • can you add your code?
  • There are a solution with autoplay but it will work only in IOS 10+
  • This methods works perfectly fine. I have no issue using it on iOS. Tested on Chrome Androïd and desktop and no issue so far. Thanks for the idea.
  • Brilliant, thanks!
  • Thanks but I don't want to use separate image or poster for video because video coming dynamically and I don't want to rework by adding separate image. You have any idea to first frame of video set as a poster.
  • No which plugin can I use?
  • It's called popcorn.js Check these 2 links:……
  • Were you able to figure out a solution?
  • Thank u I will try popcorn.js.