{"id":56674,"date":"2022-08-21T03:01:54","date_gmt":"2022-08-20T17:01:54","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=56674"},"modified":"2022-08-20T22:00:35","modified_gmt":"2022-08-20T12:00:35","slug":"video-file-browse-preview-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/video-file-browse-preview-tutorial\/","title":{"rendered":"Video File Browse Preview Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/video_browse_preview.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Video File Browse Preview Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/video_browse_preview.gif\" title=\"Video File Browse Preview Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Video File Browse Preview Tutorial<\/p><\/div>\n<p>The <a target=_blank title='HTML Canvas element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>canvas<\/a> element introduced with HTML5 resulted in great new graphical data manipulation possibilities.  The canvas method <a target=_blank title='HTML5 canvas drawImage information' href='https:\/\/www.w3schools.com\/tags\/canvas_drawimage.asp'>&#8220;drawImage&#8221;<\/a> &#8230;<\/p>\n<blockquote cite='https:\/\/www.w3schools.com\/tags\/canvas_drawimage.asp'><p>\nThe drawImage() method draws an image, canvas, or video onto the canvas.<br \/>\n<br \/>\nThe drawImage() method can also draw parts of an image, and\/or increase\/reduce the image size.\n<\/p><\/blockquote>\n<p> &#8230; is a case in point.  The implication of the first parameter accepting a &#8220;video&#8221; element means that we can just use client Javascript means to use a canvas element as the conduit for determining a video&#8217;s first (image) frame.  And once in &#8220;image land&#8221; any number of other ways to display that &#8220;first frame&#8221; are available via the data-uri available via the canvas method <a target=_blank title='HTML5 canvas toDataURL information' href='https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/HTMLCanvasElement\/toDataURL'>&#8220;toDataURL&#8221;<\/a> &#8230;<\/p>\n<blockquote cite='https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/HTMLCanvasElement\/toDataURL'><p>\nThe HTMLCanvasElement.toDataURL() method returns a data URL containing a representation of the image in the format specified by the type parameter.\n<\/p><\/blockquote>\n<p>That is all fine in theory, but writing a &#8220;proof of concept&#8221; usage of this canvas talent, we turned to two very useful links &#8230;<\/p>\n<ul>\n<li><a target=_blank title='https:\/\/jsfiddle.net\/p42867ys\/' href='\/\/jsfiddle.net\/p42867ys\/'>https:\/\/jsfiddle.net\/p42867ys\/<\/a> &#8230; and &#8230;<\/li>\n<li><a target=_blank title='https:\/\/stackoverflow.com\/questions\/19988272\/html5-canvas-drawimage-from-video-not-showing-on-first-draw' href='\/\/stackoverflow.com\/questions\/19988272\/html5-canvas-drawimage-from-video-not-showing-on-first-draw'>javascript &#8211; HTML5 Canvas drawImage from video not showing on first draw &#8211; Stack Overflow<\/a><\/li>\n<\/ul>\n<p> &#8230; thanks &#8230; helping us piece together our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/video_browse_preview.html_GETME\">&#8220;proof of concept&#8221; video_browse_preview.html<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/video_browse_preview.html\" title=\"Click picture\">Video File Browse Preview<\/a> web application &#8230;<\/p>\n<p><iframe src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/video_browse_preview.html\" style=\"width:100%;height:900px;\"><\/iframe><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d56674' onclick='var dv=document.getElementById(\"d56674\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/canvas\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d56674' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The canvas element introduced with HTML5 resulted in great new graphical data manipulation possibilities. The canvas method &#8220;drawImage&#8221; &#8230; The drawImage() method draws an image, canvas, or video onto the canvas. The drawImage() method can also draw parts of an &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/video-file-browse-preview-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,12,14,37],"tags":[184,2518,4071,460,576,578,590,652,997,2324,1319,1369],"class_list":["post-56674","post","type-post","status-publish","format-standard","hentry","category-animation","category-elearning","category-event-driven-programming","category-tutorials","tag-canvas","tag-drawimage","tag-first-frame","tag-frame","tag-html","tag-html5","tag-image","tag-javascript","tag-programming","tag-todataurl","tag-tutorial","tag-video"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/56674"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=56674"}],"version-history":[{"count":5,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/56674\/revisions"}],"predecessor-version":[{"id":56679,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/56674\/revisions\/56679"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=56674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=56674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=56674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}