{"id":22510,"date":"2016-06-06T03:01:14","date_gmt":"2016-06-05T17:01:14","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=22510"},"modified":"2016-06-05T14:36:06","modified_gmt":"2016-06-05T04:36:06","slug":"youtube-api-video-resizing-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/youtube-api-video-resizing-tutorial\/","title":{"rendered":"YouTube API Video Resizing Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.htm\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"YouTube API Video Resizing Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/youtube_api_more.jpg\" title=\"YouTube API Video Resizing Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">YouTube API Video Resizing Tutorial<\/p><\/div>\n<p>We continue with our <a target=_blank title='YouTube' href='http:\/\/youtube.com'>YouTube<\/a> <a target=_blank title='YouTube API for Iframe embedded videos' href='https:\/\/developers.google.com\/youtube\/iframe_api_reference'>API for Iframe embedded videos<\/a> today building on yesterday&#8217;s <a title='YouTube API Start and Stop Synchronizing Tutorial' href='#yasascst'>YouTube API Start and Stop Synchronizing Tutorial<\/a> as shown below.<\/p>\n<p>The matters we&#8217;d like to direct your attention to today are &#8230;<\/p>\n<ul>\n<li>width and height of YouTube embedded Iframe player<\/li>\n<li>audio volume<\/li>\n<li>video playback rate<\/li>\n<li>video playback quality<\/li>\n<\/ul>\n<p> &#8230; respectively involving API reference to &#8230;<\/p>\n<ul>\n<li><a target=_blank href='https:\/\/developers.google.com\/youtube\/iframe_api_reference#Loading_a_Video_Player'>width and height of YouTube embedded Iframe player<\/a> are parameters for the &#8220;Player&#8221; constructor, and we don&#8217;t use it, but you can <a target=_blank href='https:\/\/developers.google.com\/youtube\/iframe_api_reference#Playback_controls'>dynamically change width and height<\/a> via methods are discussed under &#8220;Setting the player size&#8221;<\/li>\n<li><a target=_blank href='https:\/\/developers.google.com\/youtube\/iframe_api_reference#Playback_controls'>audio volume<\/a> methods are discussed under &#8220;Changing the player volume&#8221;<\/li>\n<li><a target=_blank href='https:\/\/developers.google.com\/youtube\/iframe_api_reference#Playback_controls'>video playback rate<\/a> methods are discussed under &#8220;Setting the playback rate&#8221;<\/li>\n<li><a target=_blank href='https:\/\/developers.google.com\/youtube\/iframe_api_reference#Playback_quality'>video playback quality<\/a> methods are discussed under &#8220;Playback quality&#8221;<\/li>\n<\/ul>\n<p>Here&#8217;s the updated HTML and Javascript code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.html--GETME\" title='stop_start_youtube.html'>stop_start_youtube.htm<\/a>, changed from yesterday in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.html--GETME\" title='stop_start_youtube.html'>this way<\/a> with its <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.htm\" title='Click picture'>live run<\/a> link for you to try these new ideas yourself.<\/p>\n<hr>\n<p id='yasascst'>Previous relevant <a target=_blank title='YouTube API Start and Stop Synchronizing Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/youtube-api-start-and-stop-synchronizing-tutorial\/'>YouTube API Start and Stop Synchronizing Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.htm\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"YouTube API Video Synchronizing Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/youtube_synchronizing.jpg\" title=\"YouTube API Video Synchronizing Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">YouTube API Video Synchronizing Tutorial<\/p><\/div>\n<p><a target=_blank title='YouTube' href='http:\/\/youtube.com'>YouTube<\/a> is a very well known, and the most popular video watching website on the &#8220;net&#8221;, owned by <a target=_blank title='Google' gref='http:\/\/www.google.com'>Google<\/a>, and yesterday we started on a quest to do some work with the great <a target=_blank title='YouTube API for Iframe embedded videos' href='https:\/\/developers.google.com\/youtube\/iframe_api_reference'>YouTube API for Iframe embedded videos<\/a> when we presented <a title='YouTube API Start and Stop Primer Tutorial' href='#yasaspt'>YouTube API Start and Stop Primer Tutorial<\/a> as shown below.<\/p>\n<p>We are not alone on this quest, we are sure, and today we use the API to sequence YouTube videos by adding to yesterday&#8217;s functionality with &#8230;<\/p>\n<ol>\n<li>use of an HTML <a target=_blank title='Javascript DOM document.write method information from wschools' href='http:\/\/www.w3schools.com\/html\/html_forms.asp'>form<\/a> element (<i>method=GET<\/i> <i>action=.\/stop_start_youtube.htm<\/i> <i>target=_self<\/i>) to collect follow up YouTube video ids the user wants to play<\/li>\n<li>catering for the user pausing the video, a practicality that could help give the user time to enter large numbers of follow up video &#8230; <a target=_blank title='Nala and Luna' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.htm?vid=kMGJ0VyUmvI&#038;playtime=-1000&#038;this=&#038;next=kMGJ0VyUmvI&#038;next2=k8015YUEeC0&#038;next3=cGdz3GNhEQ4&#038;next4=Ei_VUl8qdRU'><i>binge<\/i><\/a> anyone?!<\/li>\n<\/ol>\n<p>The <i>method=GET<\/i> is fine because &#8230;<\/p>\n<ol>\n<li>YouTube video ids are quite short and so many can be stored in a URL without overshooting the web server length limits here &#8230; and that means &#8230;<\/li>\n<li><i>method=GET<\/i> ensures all information is contained in <i>document.URL<\/i> and entirely processed by Javascript client methodologies without the <i>method=POST<\/i> complications of involving a serverside program like PHP in this web application&#8217;s architecture<\/li>\n<\/ol>\n<p>The <i>action=.\/stop_start_youtube.htm<\/i> <i>target=_self<\/i> combination means that the change of video becomes pretty seamless, into the same original webpage of interest, using the same original HTML and Javascript codebase of interest.<\/p>\n<p>And so the mechanism for making use of this optional video synchronizing, or sequencing, functionality is to answer the video duration question with a negative number reflecting the total number of videos to play, so, again, nothing radical has changed with the look of the web application as it starts as yesterday&#8217;s functionality is still pushed as the default functionality ideas of use.<\/p>\n<p>Here&#8217;s the HTML and Javascript code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.html-GETME\" title='stop_start_youtube.html'>stop_start_youtube.htm<\/a>, changed from yesterday in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.html-GETME\" title='stop_start_youtube.html'>this way<\/a> with its <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.htm\" title='Click picture'>live run<\/a> link for you to try this out yourself.<\/p>\n<hr>\n<p id='yasaspt'>Previous relevant <a target=_blank title='YouTube API Start and Stop Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/youtube-api-start-and-stop-primer-tutorial\/'>YouTube API Start and Stop Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"YouTube API Stop and Start Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/youtube_start_stop.jpg\" title=\"YouTube API Start and Stop Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">YouTube API Start and Stop Primer Tutorial<\/p><\/div>\n<p><a target=_blank title='YouTube' href='http:\/\/youtube.com'>YouTube<\/a> is a very well known, and the most popular video watching website on the &#8220;net&#8221;.<\/p>\n<p>It is no surprise that programmers and developers everywhere are interested in interfacing to it.  We interface to it today, just purely with client side HTML and Javascript and the wonderful <a target=_blank title='YouTube API for Iframe embedded videos' href='https:\/\/developers.google.com\/youtube\/iframe_api_reference'>YouTube API for Iframe embedded videos<\/a> reference website, the information for which we got directed to via this <a target=_blank title='Useful link' href='http:\/\/stackoverflow.com\/questions\/6970013\/getting-current-youtube-video-time'>useful link<\/a> &#8230; so thanks, everybody.<\/p>\n<p>Using the YouTube API means you&#8217;ve got access to information, such as &#8230;<\/p>\n<ul>\n<li>the total length of the video clip<\/i>\n<li>the accumulated length you have watched<\/li>\n<\/ul>\n<p> &#8230; without which it is hard to do what we want to do today.  And that is simply to ask you for &#8230;<\/p>\n<ol>\n<li>YouTube video identifier<\/li>\n<li>how many seconds do you want to use to start and stop your way through the viewing &#8230; -1 here let&#8217;s you view the whole video in one session<\/li>\n<\/ol>\n<p>This exercise was helped enormously by the great example code at the <a target=_blank title='YouTube API for Iframe embedded videos' href='https:\/\/developers.google.com\/youtube\/iframe_api_reference'>YouTube API for Iframe embedded videos<\/a> reference website.<\/p>\n<p>Here&#8217;s the HTML and Javascript code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.html_GETME\" title='stop_start_youtube.html'>stop_start_youtube.html<\/a> with its <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/stop_start_youtube.html\" title='Click picture'>live run<\/a> link, as well.<\/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='#d22484' onclick='var dv=document.getElementById(\"d22484\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/api\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d22484' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\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='#d22496' onclick='var dv=document.getElementById(\"d22496\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/form\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d22496' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\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='#d22510' onclick='var dv=document.getElementById(\"d22510\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/video\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d22510' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We continue with our YouTube API for Iframe embedded videos today building on yesterday&#8217;s YouTube API Start and Stop Synchronizing Tutorial as shown below. The matters we&#8217;d like to direct your attention to today are &#8230; width and height of &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/youtube-api-video-resizing-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":[12,33,37],"tags":[88,113,1896,212,452,513,576,652,997,1897,1059,1895,1670,1319,1345,1369,1391,1493],"class_list":["post-22510","post","type-post","status-publish","format-standard","hentry","category-elearning","category-software","category-tutorials","tag-api","tag-audio","tag-binge","tag-client","tag-form","tag-google","tag-html","tag-javascript","tag-programming","tag-quality","tag-resize","tag-sequence","tag-synchronize","tag-tutorial","tag-url","tag-video","tag-volume","tag-youtube"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22510"}],"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=22510"}],"version-history":[{"count":2,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22510\/revisions"}],"predecessor-version":[{"id":22512,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22510\/revisions\/22512"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=22510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=22510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=22510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}