The Wrecking Crew Dynamic Javascript YouTube Embedded API Ajax Tutorial
โœ‚๐Ÿƒ๐Ÿพโ€โ™€๏ธ๐Ÿƒ๐Ÿผโ€โ™‚๏ธ
๐Ÿ“–

The Wrecking Crew Dynamic Javascript YouTube Embedded API Ajax Tutorial

The Wrecking Crew Dynamic Javascript YouTube Embedded API Ajax Tutorial

Itโ€™s time for us to revisit the relatively recent User Controlled Dynamic Javascript YouTube Embedded API Ajax Tutorial with new content featuring music that โ€œThe Wrecking Crewโ€ were involved in. We were gobsmacked last weekend listening to โ€ฆ

  • Weekends with Simon Marnie on 702 radio Sydney, Australia on Saturday 26/9/2020โ€™s โ€œSonic Journeyโ€ segment regarding โ€œThe Wrecking Crewโ€ (Hal Blaine, Glen Campbell etcetera) โ€ฆ

    The Wrecking Crew was a loose collective of session musicians based in Los Angeles whose services were employed for thousands of studio recordings in the 1960s and 1970s, including several hundred Top 40 hits. The musicians were not publicly recognized in their era, but were viewed with reverence by industry insiders. They are now considered one of the most successful and prolific session recording units in music history.

    โ€ฆ and their huge influence on the music of the 60โ€™s and early 70โ€™s (and beyond, especially regarding work with Phil Spector)

  • Wikipediaโ€™s great online resource The Wrecking Crew
  • User Controlled Dynamic Javascript YouTube Embedded API Ajax Tutorialโ€˜s disco_versionโšซhtml use of YouTubeโ€˜s IFrame Player API as a basis to โ€ฆ
    1. two finger gesture over a Wikipedia song link and choose โ€˜Search Google for โ€œSong Titleโ€โ€˜
    2. up at Google two finger gesture relevant YouTube link and choose โ€˜Copy Link Addressโ€™
    3. add to codeโ€™s array stripping out all but the 11 character YouTube video ID

โ€ฆ and let this great music of the 60โ€™s and early 70โ€™s roll! You can see how this all happened at the_wrecking_crewโšซhtmlโ€˜s liveโœ‚run link.



Previous relevant User Controlled Dynamic Javascript YouTube Embedded API Ajax Tutorial is shown below.

User Controlled Dynamic Javascript YouTube Embedded API Ajax Tutorial

User Controlled Dynamic Javascript YouTube Embedded API Ajax Tutorial

Around here we have our favourite Javascript and PHP function names. And in that list, the Javascript โ€œajaxit([argument1])โ€ features strongly and commonly. After reaching below the sink After talking excitedly to the kitchen taps about my plans โ€ฆ oddly, receiving no reply โ€ฆ probably because itโ€™s a Monday here โ€ฆ we expect โ€ฆ we use that Javascript client Ajax approach that can do for you what you would often call on a serverside language, like PHP, to do?! Anyone, anyone? No, Barbara Woodhouse, we do not wrelease the tap dancing dogs on Mondays โ€ฆ ever โ€ฆ any more serious suggestions please? Yes, Jesse James Garrett itโ€™s interesting your blurtings include โ€ฆ

the asynchronous technology behind emerging services like Google Maps and Google Suggest, as well as the resulting user experience which made it possible to browse without interruption by eliminating the reloading of the whole page

โ€ฆ though Iโ€™d like you to run a plagorism checker on all โ€œblurtingsโ€ and โ€œlertsโ€ for the next lesson please.

Yes, under certain conditions, Ajax (methodologies) can retrieve information and not have to leave what you are interacting with on the current webpage, to do this.

Can you imagine how we might apply this with our current project? Yes, patently not everyone is in the mood for โ€œDiscoโ€, especially on the first draft way back when, when we allowed sound to happen before a decently โ€œflaggedโ€ button press to forewarn โ€ฆ a fairly big โ€œInternet sinโ€, since fixed. And so, we now add HTML input textbox (ie.type=text) element, with onblur event โ€œajaxit([argument1])โ€ logic (passing across the textboxโ€™s value) as per โ€ฆ



var zhr=null;

var url='';

var zok=0;



function ajaxit(qsel) {

if (qsel != '') {

url="//www.rjmprogramming.com.au/HTMLCSS/legend_via_map.php?url=" + encodeURIComponent("//www.youtube.com/results?search_query=" + encodeURIComponent(qsel));

if (!zhr) {

zhr = getXMLHttpRequest();

}



if (zhr != null) {

zhr = zhr;

} else {

try {

zhr = new ActiveXObject("Msxml2.XMLHTTP");

} catch (othermicrosoft) {

try {

zhr = new ActiveXObject("Microsoft.XMLHTTP");

} catch (failed) {

zhr = false;

}

}

}




if (zhr) {

if (url != '') {

zok=0;

zhr.open("GET", url, true);

zhr.onreadystatechange = showStuff;

zhr.send(null);

url='';

}

} else {

zok = 1; //alert("Sorry ... no XMLHttpRequest possible");

}

}

}

โ€ฆ to add new concepts into the mix of option (sub)elements offered off that aforesaid mentioned (multiple selection mode) dropdown (of YouTube videos). As an optional โ€œoff default workflowโ€ piece of functionality we show it prominently (above the fold) now, as well as โ€œbelow the foldโ€ where the dropdown is positioned on the webpage of theAjax changed disco_versionโšซhtmlโ€˜s liveโœ‚run.

Adding to yesterdayโ€™s User Controlled Dynamic Javascript YouTube Embedded API Ordered Tutorial โ€ฆ


Previous relevant User Controlled Dynamic Javascript YouTube Embedded API Ordered Tutorial is shown below.

User Controlled Dynamic Javascript YouTube Embedded API Ordered Tutorial

User Controlled Dynamic Javascript YouTube Embedded API Ordered Tutorial

We think that whenever you โ€ฆ

  • deprive many people of โ€œorderโ€ in their lives โ€ฆ theyโ€™ll crave for (and maybe seek out) โ€œorderโ€ โ€ฆ and when you โ€ฆ
  • deprive many people of โ€œrandomosityโ€ in their lives โ€ฆ theyโ€™ll crave for (and maybe seek out) โ€œrandomosityโ€

โ€ฆ and so we see a mix of both in a web application as an advantage. Today, for the first time we can remember, extending onto yesterdayโ€™s User Controlled Dynamic Javascript YouTube Embedded API Tutorial functionality, definitely lacking some โ€œorderโ€ we feel, weโ€™ve allowed a โ€ฆ

  • select โ€œdropdownโ€ element โ€ฆ
  • multiple mode โ€ฆ have its โ€ฆ
  • button press โ€œfinish of selectionsโ€ event logic โ€ฆ


    function process(bsin) {

    var jj=0, mbo='', mlist='', mdelim='', vscnt=0;

    var sin=document.getElementById(bsin.id.replace('b','s'));

    for (var i=0; i<sin.options.length; i++) {

    if (sin.options[i].selected) {

    if (sin.options[i].value != '') {

    jj++;

    vscnt++;

    mbo=sin.options[i].value.split('|')[0];

    mlist+=mdelim + sin.options[i].value.split('|')[0];

    mdelim=',';

    }

    }

    }

    if (jj == 1) {

    location.href=(document.URL.split('#')[0].replace('mustbeone=','mustxxxbeone=') + '&mustbeone=' + encodeURIComponent(mbo)).replace('.html&','.html?').replace('.htm&','.htm?').replace('.php&','.php?').replace('/&','/?');

    } else if (jj > 1) {

    if (oclickcnt == vscnt) { mlist=olist; }

    location.href=(document.URL.split('#')[0].replace('mustbeone=','mustxxxbeone=').replace('videolist=','videoxxxlist=') + '&videolist=' + encodeURIComponent(mlist)).replace('.html&','.html?').replace('.htm&','.htm?').replace('.php&','.php?').replace('/&','/?');

    }

    oclickcnt=0;

    occ=[];

    olist='';

    odelim='';

    }

  • take into account the order the user clicked select element option elements โ€ฆ


    var oclickcnt=0;

    var occ=[];

    var olist='';

    var odelim='';



    function oclick(opto) {

    oclickcnt++;

    olist+=odelim + opto.id.split('|')[0];

    odelim=',';

    }


    โ€ฆ option element onclick event Javascript event logicโ€ฆ so long as โ€ฆ
  • these two or more clicks/touches on option elements (via their onclick event logics) (total in) number (to) the same (total) as the final number of options selected (ie. most โ€œshiftโ€ key arrangement selections cannot be catered for in this logic, but totally โ€œctrlโ€ (Windows) / โ€œcommandโ€ (macOS) key may work)

โ€ฆ allowing for the user to control the video list, and its order.

And on non-mobile platforms, we allow for a natural โ€œsequencingโ€ of play, once the first video is played and unmuted. That way, on non-mobile, yourchanged disco_versionโšซhtml liveโœ‚run web application can act like a continuous (radio like) โ€œstreamโ€ of music. Even so, on non-mobile, a user can โ€œpauseโ€ a video, and start another via their own user actions, and the โ€œstreamโ€ sequencing will change to fit in with the changed arrangements.


Previous relevant User Controlled Dynamic Javascript YouTube Embedded API Tutorial is shown below.

User Controlled Dynamic Javascript YouTube Embedded API Tutorial

User Controlled Dynamic Javascript YouTube Embedded API Tutorial

The recent Dynamic Javascript and the YouTube Embedded API Tutorial showed the great YouTube IFrame Player API in action, including โ€ฆ and this dovetails well into todayโ€™s work โ€ฆ no advertisements.

A lot of us will know how great YouTube playlists are. Today, we offer a(n example of) โ€ฆ

  • an up to 9 โ€œDisco Versionโ€ random array of YouTube videos that can be played ina session โ€ฆ
  • from a possible array of 24 table cell slots (10-24 not shown, but โ€œdurationโ€able behind the scenes) โ€ฆ
  • the 15 not randomly picked available to the user in a dropdown selection they can, optionally โ€ฆ
    1. pick one from,click a โ€œShuffleโ€ button, and a randomized list of 8 others is headedby your selected video โ€ฆ or โ€ฆ
    2. pick more than one and the first (up to 9) forms your ordered selection of playable videos

โ€ฆ and the progress today leaves you controlling when to play the videos, yourself, clicking YouTube play buttons to make that happen.

Enjoy the โ€œhowwe got thereโ€ disco_versionโšซhtml upbeatโœ‚disco selection live run link.


Previous relevant Dynamic Javascript and the YouTube Embedded API Tutorial is shown below.

Dynamic Javascript and the YouTube Embedded API Tutorial

Dynamic Javascript and the YouTube Embedded API Tutorial

Webpages without Javascript are generally pretty static and boring. Javascript is that dynamic client addition to webpage functionality, but perhaps you only think of it as that statically written part of the webpage unable to be reloaded into effect after that initial webpage load. Well, that is not taking into account Javascript such as โ€ฆ



<script>

var tag = document.createElement('script');

tag.src = "https://www.youtube.com/iframe_api";

var firstScriptTag = document.getElementsByTagName('script')[0];

firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

</script>

โ€ฆ taken from the excellent YouTube IFrame Player API we really like to use around here to embed and control YouTube videos embedded into an HTML iframe element.

In todayโ€™s small extension of that we load nine such HTML iframe embedded YouTube videos into a 3ร—3 grid. We resisted the previous Brady Bunch usage of such an arrangement (perhaps youโ€™ll be sad to hear?!) in favour of showing you a โ€œcollageโ€ of video snippets from one of my favourite films ever, Mr Smith Goes to Washington.

We hope the HTML and Javascript dynamic_jsโšซhtmlโ€˜s code will be food for thought, that you can test for yourself at this liveโœ‚run link.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in Ajax, eLearning, Event-Driven Programming, Tutorials and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *