Overlay Iframe Remembering Textarea Client Sharing Tutorial
โœ‚๐Ÿƒ๐Ÿพโ€โ™€๏ธ๐Ÿƒ๐Ÿผโ€โ™‚๏ธ
๐Ÿ“–

Overlay Iframe Remembering Textarea Client Sharing Tutorial

Overlay Iframe Remembering Textarea Client Sharing Tutorial

Our title today is โ€œOverlay Iframe Remembering Textarea Client Sharing Tutorialโ€, a curiosity for some readers, am sure, being the word โ€œClientโ€œ. This is a deliberate word, not an accident, because we intend going as far as we can not involving a serverside language like PHP in the workings of our โ€œOverlay Iframe Rememberingโ€ methodology โ€œBackground Layer Wordingโ€ web application. Where it comes to โ€œSharingโ€, whatโ€™s the big deal? Well, when you involve PHP serverside thoughts an email attachment can be coded and programmed for within your web application, but not with Javascript client work, only. So what can we do? We can provide a mechanism to allow the user the chance to โ€œSelect Allโ€ and โ€œCopyโ€ some image data that can then be โ€œPasteโ€d into the body section of an Email Client email message, to form an email attachment on the occasion of that user clicking the Email Clientโ€™s Send button.

So, further to yesterdayโ€™s Overlay Iframe Remembering Textarea Quiz Tutorial โ€œfirst variantโ€ quiz, the architecture of the underlying web application gets a โ€œnew layer makeoverโ€ of HTML5 canvas element(s). Contributing parts to that canvas elementโ€™s data come from a variety of textarea layers (remember the different font colurs and the โ€œSwap Layerโ€ button), and so, it is easiest to get our head around compiling all this into โ€ฆ



top.document.getElementById('canvasid')

โ€ฆ as the (Javascript) DOM object reference to this โ€œtopโ€ (and first) created canvas element with all this. See in the code also, codelines like โ€ฆ



top.canvtext(parent.document.getElementById('tais').value);

โ€ฆ which, no matter how far down into the textarea layers you are, will call on that first defined version of that Javascript function โ€œcanvtextโ€ (with the parent textarea content as via parent.document.getElementById(โ€˜taisโ€™).value), as per โ€ฆ



function canvtext(intxt) {

var zero=0;

var loca=intxt.split(String.fromCharCode(10));

if (lines.length != 0 && loca.length != 0 && loca.length >= lines.length) {

if (lines[0] == loca[0]) { lines=[]; }

}

if (lines.length == 0) {

ty=14;

context.font = cf;

eval(clearcmd);

if (documentURL.indexOf(se) != -1) { // is original background layer

context.strokeStyle = "blue";

} else {

context.strokeStyle = "black";

}

lines=intxt.split(String.fromCharCode(10));

for (ilines=zero; ilines<lines.length; ilines++) {

if (lines[ilines] == "" && linesb.length > ilines) {

if (linesb[ilines] != '') {

if (documentURL.indexOf(se) != -1) { // is original background layer

context.strokeStyle = "black";

} else {

context.strokeStyle = "blue";

}

context.strokeText(linesb[ilines],tx,ty);

if (documentURL.indexOf(se) != -1) { // is original background layer

context.strokeStyle = "blue";

} else {

context.strokeStyle = "black";

}

}

} else {

context.strokeText(lines[ilines],tx,ty);

}

ty+=12;

}

} else {

zero=eval('' + lines.length);

for (var iloca=zero; iloca<loca.length; iloca++) {

lines.push(loca[iloca]);

}

for (ilines=zero; ilines<lines.length; ilines++) {

if (lines[ilines] == "" && linesb.length > ilines) {

if (linesb[ilines] != '') {

if (documentURL.indexOf(se) != -1) { // is original background layer

context.strokeStyle = "blue";

} else {

context.strokeStyle = "black";

}

context.strokeText(linesb[ilines],tx,ty);

if (documentURL.indexOf(se) != -1) { // is original background layer

context.strokeStyle = "black";

} else {

context.strokeStyle = "blue";

}

}

} else {

context.strokeText(lines[ilines],tx,ty);

}

ty+=12;

}

document.getElementById('icanvas').innerHTML='<img style="display:none;" onload="imgonl(this);" src="' + elem.toDataURL() + '" title="Canvas contents"></img>';

}

}

The big deal of this? Well, involving client code usage only, there is no way to create an email with multi-colour text, but you can here, because that multi-colour text from various textarea (text input and output) elements is compiled into that top canvas element and sent to a popup window content via a [canvas].toDataURL method data URI img element โ€œsrcโ€ property assignment. Then it is optionally available to a user to use whatever operating system method is available to them to Select All/Copy this ready for a Paste operation somewhere else (and weโ€™re suggesting Email, as an attachment, though there are a myriad of other ideas you could use this โ€œcopy bufferโ€ for).

And so, again, thechanged third draft of add_background_layerโšซhtm can be tried yourself at todayโ€™s liveโœ‚run link.



Previous relevant Overlay Iframe Remembering Textarea Quiz Tutorial is shown below.

Overlay Iframe Remembering Textarea Quiz Tutorial

Overlay Iframe Remembering Textarea Quiz Tutorial

Today we construct our first โ€œoverlay iframe rememberingโ€ variant on yesterdayโ€™s Overlay Iframe Remembering Textarea Primer Tutorial โ€œproof of conceptโ€ textarea web application. This variant is a โ€ฆ

  • Country Capital Quiz โ€ฆ featuring โ€ฆ
  • a teletext feel โ€ฆ to its presentation of the โ€ฆ
  • question โ€ฆ whose โ€ฆ
  • answer can be a Capital City name or Country name โ€ฆ all via โ€ฆ
  • English language

You answer in a textbox and because we are comparing to Capital City or Country place names whose characters may fall outside the English keyboard letters ascii range we donโ€™t want to penalise users who donโ€™t enter those UTF-8 non-ascii characters that may be involved. So, what to do?

  • firstly, up in the โ€œheadโ€ section (of this web applicationโ€™s webpage) allow for the UTF-8 characters โ€ฆ


    <meta charset="utf-8"/>

  • secondly, define the data in a select element, the second option tag of which we exemplify below contains a non-ascii character example Capital City โ€ฆ


    <select style='display:none;' id=capitals>

    ...

    <option value="China">Beijing</option>

    <option value="Colombia">Bogotรก</option>

    ...

    </select>


    โ€ฆ and then โ€ฆ
  • populate two global arrays via โ€ฆ


    var capitals=[],countries=[];



    if (capitals.length == 0) {

    var optsare=document.getElementById('capitals').innerHTML.split('</option>');

    for (var iopts=0; iopts<optsare.length; iopts++) {

    if (optsare[iopts].trim() != '') {

    capitals.push(optsare[iopts].split('>')[eval(-1 + optsare[iopts].split('>').length)].split(',')[0].split(' (')[0]);

    countries.push(optsare[iopts].split(' value="')[1].split('"')[0]);

    }

    }

    }


    โ€ฆ as the basis for โ€ฆ
  • randomly picking a question and answer set that uses our โ€œoft used techniqueโ€ (with a small twist) as per โ€ฆ


    choice=Math.floor(Math.random() * eval(2 * eval('' + capitals.length)));


    โ€ฆ that small twist helping us randomize the idea of whether the answer should be a Capital City or a Country place name โ€ฆ the question of which we โ€ฆ
  • display in that โ€œteletextโ€ way via โ€ฆ


    function teletextit() {

    if (eval('' + iq) < eval('' + question.length)) {

    document.getElementById('tais').value+=question.substring(iq, eval(1 + iq));

    }

    iq++;

    if (eval('' + iq) < eval('' + question.length)) {

    setTimeout(teletextit, 200);

    } else {

    document.getElementById('tais').value+=String.fromCharCode(10) + String.fromCharCode(10);

    }

    }


    โ€ฆ and then over to the user interaction, and on checking that user answer provided โ€ฆ
  • later, to test answer correctness we donโ€™t use the โ€œascii friendlyโ€ indexOf (as we so often use) but, instead, use โ€ฆ


    function oneintwo(aone, atwo) {

    var ret=false, ijk=0, jkl=0, iij=0, jjj=0;

    if (atwo != '' && aone != '' && atwo.length >= 3 && aone.length >= 3) {

    ijk=atwo.indexOf(aone.substring(0,1));

    if (ijk >= 0) {

    iij=ijk;

    ret=true;

    for (jkl=ijk; jkl<eval(eval('' + ijk) + eval('' + aone.length)); jkl++) {

    if (ret && atwo.substring(jkl, eval(1 + iij)) >= 'a' && atwo.substring(jkl, eval(1 + iij)) <= 'z') {

    if (ret && aone.substring(jjj, eval(1 + jjj)) >= 'a' && aone.substring(jjj, eval(1 + jjj)) <= 'z') {

    if (atwo.substring(iij).indexOf(aone.substring(jjj, eval(1 + jjj))) >= 0) {

    iij+=atwo.substring(iij).indexOf(aone.substring(jjj, eval(1 + jjj)));

    } else {

    ret=false;

    }

    }

    }

    jjj++;

    }

    }

    }

    return ret;

    }


    โ€ฆ which would return true for oneintwo(โ€œBogotaโ€, โ€œBogotรกโ€) as, in all fairness, it should

And so thechanged second draft of add_background_layerโšซhtm can be tried yourself at todayโ€™s liveโœ‚run link.


Previous relevant Overlay Iframe Remembering Textarea Primer Tutorial is shown below.

Overlay Iframe Remembering Textarea Primer Tutorial

Overlay Iframe Remembering Textarea Primer Tutorial

The recent HTML5 Web Audio Overlay Tutorial introduced a new term for us โ€ฆ

overlay iframe remembering

โ€ฆ trying to give a name (or term) to the โ€œoverlayโ€ idea of a โ€ฆ

  • parent webpage โ€ฆ completely being overlayed (via the auspices of three of our favourite overlay suspects) โ€ฆ
    1. position:absolute property
    2. z-index
    3. opacity

    โ€ฆ but being seen through a โ€ฆ

  • child โ€œiframeโ€ webpage

โ€ฆ as two webpages with sharable data.

Youโ€™ll also know, if you are a regular at this blog, how we like, and โ€œare suckersโ€ for the use of the HTML textarea element โ€ฆ giggle at your peril โ€ฆ โ€œrevenge of the textareaโ€ is coming. In this context, why donโ€™t we combine the concepts above? Before you โ€œBah, humbug!โ€ weโ€™re ready with the <strike></strike> to โ€œcounter any Bah, humbug! with the idea that two textareas can represent two voices and so represent a conversation, albeit, today, only with somebody close byโ€. We donโ€™t venture that far ourselves with this separation today, being a bit bamboozled by the complexity of the logic โ€ฆ only โ€ฆ

  • changing the font colours โ€ฆ and โ€ฆ
  • allowing for textarea โ€œfocusโ€ swaps โ€ฆ and โ€ฆ
  • allowing for contributions to the background textarea from the foreground

โ€ฆ but that doesnโ€™t preclude you from downloading todayโ€™s first draft of add_background_layerโšซhtml and/or trying it for yourself at todayโ€™s liveโœ‚run link, and adding your own ideas onto this HTML and Javascript โ€œproof of conceptโ€ start.


Previous relevant HTML5 Web Audio Overlay Tutorial is shown below.

HTML5 Web Audio Overlay Tutorial

HTML5 Web Audio Overlay Tutorial

Again, in building on yesterdayโ€™s HTML5 Web Audio Duration Tutorial two pronged approach, we have another one today, those approaches involving โ€ฆ

  • first allow for clientside HTML to do what serverside PHP usually does for us โ€ฆ handle large amounts of data as PHP can do using its $_POST[] approach โ€ฆ weโ€™re going to call โ€œOverlay Iframe Rememberingโ€ โ€ฆ whereby the
    1. navigational form gets a new id=waform onsubmit=โ€™return takealook(this);โ€™ โ€ฆ


      function takealook(fo) {

      var noneed=true;

      var nsuffix='';

      if (document.getElementById('url1').value.length > 500) { noneed=false; }

      if (document.getElementById('url2').value.length > 500) { noneed=false; }

      if (document.getElementById('url3').value.length > 500) { noneed=false; }

      if (document.getElementById('url4').value.length > 500) { noneed=false; }

      if (document.getElementById('durationget').value.length > 0) { nsuffix='ยฌoka=secret'; noneed=false; }

      if (source_valid()) {

      if (noneed) { return true; }

      document.getElementById('divbody').style.opacity='0.2';

      document.getElementById('diframe').innerHTML="<iframe style='position:absolute;top:0px;left:0px;z-index:" + eval(1 + eval('0' + zi)) + ";width:100%;height:100vh;' src='" + document.URL.split('#')[0].split('?')[0] + "?zi=" + eval(1 + eval('0' + zi)) + nsuffix + "'></iframe>";

      } else {

      if (notoka.trim().toLowerCase() == 'secret') { noneed=false; }

      if (noneed) { return true; }

      document.getElementById('divbody').style.opacity='0.2';

      document.getElementById('diframe').innerHTML="<iframe style='position:absolute;top:0px;left:0px;z-index:" + eval(1 + eval('0' + zi)) + ";width:100%;height:100vh;' src='" + document.URL.split('#')[0].split('?')[0] + "?zi=" + eval(1 + eval('0' + zi)) + "ยฌoka=" + encodeURIComponent(notoka.trim()) + "'></iframe>";

      }

      return false;

      }


      โ€ฆ where if noneed ends up as false we perform some overlay favourites โ€ฆ building on โ€ฆ
    2. textbox HTML design changes from โ€ฆ


      <input style='display:inline-block;background-color:#f0f0f0;' type=text name=url2 title='Audio URL 2' value='./one_to_fiftynine.m4a'></input>


      โ€ฆ to โ€ฆ


      <input data-id=url2 onblur="document.getElementById(this.getAttribute('data-id')).value=this.value;" style='display:inline-block;background-color:#f0f0f0;' type=text name=url2 title='Audio URL 2' value='./one_to_fiftynine.m4a'></input>

      <div id=dform style='display:none;'></div>

      <div id=diframe></div>


      โ€ฆ that makes the document.body onload logic below be useful for the context of that onsubmit form logic above โ€ฆ


    3. document.getElementById('dform').innerHTML=document.getElementById('waform').innerHTML.replace(/\ data\-id=/g, ' id=').replace(/\ onblur=/g, ' data-onblur=');

    โ€ฆ as per theseinterim changes โ€ฆ then in the context of those large amounts of data possibly coming from โ€ฆ

  • like with the recent Video via Canvas File API Tutorial โ€ฆ

    โ€ฆ we see for web applications, two primary source โ€œpartitionsโ€, those being โ€ฆ

    • around the โ€œnetโ€ (in the server wooooooorrrrrlllllld, in the public areas of the Internet, which are not in โ€œthe dark webโ€, that is) via an absolute URL (to the same domain or beyond) and/or relative URL (in relation to the URL โ€œhomeโ€ place on the web server of the same domain as where you launched it โ€ฆ which we catered for yesterday, though quietly weโ€™d have allowed absolute URLs too, itโ€™s just that cross-domain restrictions make us shy about publicizing that) โ€ฆ versus โ€ฆ
    • on the client computer (or device)

    โ€ฆ and, yes, for all those who guessed weโ€™d try to cater for image and/or video data coming from this client source, you are correct โ€ฆ

    โ€ฆ media file browsing, via the wonderful File API, additional functionality as per thesechanges to web_audioโšซhtm

Did you get from the code snippets how this โ€œOverlay Iframe Rememberingโ€ works by storing the large amounts of data in an overlayed โ€œlayerโ€ of webpage, both webpage layers โ€œclientsideโ€ by nature and available datawise to each other in a parent/child (layer1WebpageParent/layer2OverlayedIframeWebpageChild) arrangement? Perhaps it is easier to see it in action at thisโœ‚live run link.


Previous relevant HTML5 Web Audio Duration Tutorial is shown below.

HTML5 Web Audio Duration Tutorial

HTML5 Web Audio Duration Tutorial

In building on yesterdayโ€™s HTML5 Web Audio Primer Tutorial we adopted a two pronged approach, that being โ€ฆ

โ€ฆ that we welcome you to try at this liveโœ‚run link.


Previous relevant HTML5 Web Audio Primer Tutorial is shown below.

HTML5 Web Audio Primer Tutorial

HTML5 Web Audio Primer Tutorial

As an audio/video synchronization alternative to the techniques used in Mac OS X Text to English Speech Primer Tutorial, today, we involve the great Web Audio API functionality introduced with HTML5 and โ€œstarringโ€ in HTML5 Rocksโ€™s Getting Started with Web Audio API great advice on this subject.

We start down this long road, we suspect, being able to โ€ฆ

  • set up the audio playing of four separate audio sources (some featuring in Spliced Audio Number Genericization Tutorial) โ€ฆ where โ€ฆ
  • one, with its default configuration, synchronizes with an apt video media play
  • allow looping
  • allow for โ€œstart atโ€ seconds
  • allow for โ€œstart inโ€ seconds

โ€ฆ on a first draft HTML and Javascript and CSS web_audioโšซhtml liveโœ‚run link.

We hope you hang around on our road trip with this topic.


Previous relevant Spliced Audio Number Genericization Tutorial is shown below.

Spliced Audio Number Genericization Tutorial

Spliced Audio Number Genericization Tutorial

If youโ€™ve completed a successful โ€œproof of conceptโ€ stage to a project, it can be tempting at this early stage, even before applying it to the specific intended software integration target, to consider ways to โ€œgenericizeโ€ that application, and so it is for us, here, with yesterdayโ€™s Spliced Audio Number Announcements Tutorial, as shown below, that we feel this could come along to be applied for other purposes. We have no doubt the exercise of doing this serves at least three good purposes โ€ฆ

  1. slow it down a bit before rushing to โ€œsoftware integrateโ€, as patience can be good here
  2. learn more about whatโ€™s possible, and what isnโ€™t, to do with the scope of your planning and thinking
  3. other application may, too, benefit from this โ€œearly daysโ€ โ€œgenericizationโ€ of a potential plugin component piece of HTML and Javascript code

In this early stage of โ€œgenericizationโ€ thoughts, we think that with our project we want to keep intact these ideas โ€ฆ

  • thereโ€™ll be up to 3 โ€œcolumnsโ€ of ideas to piece together an audio message from its constituent parts, like with those Sydney train platform announcements weโ€™ve talked about before
  • thereโ€™ll be 3 soundfiles mapped to most of the usage regarding these 3 โ€œcolumnsโ€
  • thereโ€™ll be the possibility for silence to be an option in each โ€œcolumnโ€
  • thereโ€™ll be the mechanism by which the user can define their own โ€œTitleโ€ and โ€œSubtitleโ€ and 3 โ€œcolumnโ€ headings themselves
  • thereโ€™ll be 2 leftmost โ€œcolumnsโ€ that define counting numbers whose ranges can be defined by the user, where, for now, the timing of sounds goes that sounds start at [number].4 seconds and plays for 1.5 seconds
  • thereโ€™ll be minimum and maximum special case entries available for user definition in the leftmost โ€œcolumnโ€ that calls on the fourth soundfile, where, for now, the timing of sounds goes that sounds start at 0 seconds and 2 seconds respectively and plays for 2 seconds
  • thereโ€™ll be a minimum special case entry available for user definition in the middle โ€œcolumnโ€ that calls on a sound from the third soundfile, where, for now, the timing of sounds goes that sounds start at 3.1 seconds and plays for 1.8 seconds
  • thereโ€™ll be 1 rightmost โ€œcolumnโ€ that can have three entries defined

And that is as far as we go with โ€œgenericizationsโ€, at this stage, with our project.

In our experience, what Javascript function is a big friend of โ€œgenericizationโ€? Weโ€™d say Javascript eval function is our favourite here.

Itโ€™s funny to think that our HTML and Javascript and CSS audio_1_59โšซhtm, vastly changed from yesterday as per thislink, functions exactly the same in its default form, and you can continue to enjoy its accompanying defaultโœ‚live run link, but it can, through the use of complex URLs (only, just at this early stage) be made to look quite different, with the same code, as you can see with this complexโœ‚live run.

So, in summary, this leaves us with many more โ€œlive runโ€ options, those being โ€ฆ


Previous relevant Spliced Audio Number Announcements Tutorial is shown below.

Spliced Audio Number Announcements Tutorial

Spliced Audio Number Announcements Tutorial

Weโ€™ve got a โ€œproof of conceptโ€ tutorial for you today, because weโ€™ve got an idea for something, as we said some time back at Splicing Audio Primer Tutorial โ€ฆ

The first was a simulation of those Sydney train public announcements where the timbre of the voice differs a bit between when they say โ€œPlatformโ€ and the โ€œ6โ€ (or whatever platform it is) that follows. This is pretty obviously computer audio โ€œbitsโ€ strung together โ€ฆ and wanted to get somewhere towards that capability.

โ€ฆ that will probably be blimminโ€™ obvious to you should you be a regular recent reader at this blog.

Do you remember what we, here, see as a characteristic of โ€œproof of conceptโ€ at WordPress Is Mentioned By Navigation Primer Tutorial โ€ฆ

To us, a โ€œproof of conceptโ€ is not much use if it is as involved as what it is trying to prove

โ€ฆ and do you remember how we observed at Windows 10 Cortana Primer Tutorial โ€ฆ

โ€ฆ because you can work Cortana without the voice recognition part, if you like, or if you have the urge to run for the nearest cupboard before being caught talking into a computer (microphone)

? Well, today, weโ€™d like you to be patient about the lack of audio quality with our home made audio (see excuse 2 above) bit we are mainly interested in โ€œproof of conceptโ€ issues (see excuse 1 above).

So what โ€œingredientsโ€ went into this โ€œAudio Numbersโ€ web application? As we did in Apple iOS Siri Audio Commentary Tutorial โ€ฆ

HTML audio elements that allow for an audio commentary of the 9 โ€œsubimagesโ€ โ€ฆ the content for which is derived on a Mac OS X by QuickTime Playerโ€˜s Audio Recording functionality, which we last talked about at this blog with QuickTime Player Video Flickr Share Primer Tutorial

โ€ฆ we do again today. On doing this we realized the recordings were not loud enough, so started down the road of R&D on this and got to the very useful Increase Audio Volume website tool that helped a little, and this manifests itself if/when you run our liveโœ‚run today, that if you pick โ€œminuteโ€ numbers less than or equal to โ€œ30โ€ they are a better better in volume than others, with the โ€œTrial Versionโ€ of this software helping you out with โ€œhalf fileโ€ enhancements. โ€œProof of conceptโ€, remember? And so the aspects youโ€™d change for your own purposes, are โ€ฆ

  1. the content (and more than likely, names) of audio files mentioned below โ€ฆ
  2. arrays of audio files โ€ฆ


    var audiomedia=["one_to_fiftynine.m4a","past_quarterto.m4a","am_pm.m4a"];

    var midmedia=["midnight_midday.m4a"];


    โ€ฆ and it should be noted here, that a separate file for each unique sound, could be a good alternative design, and would stop failures to do with the slow loading speed of the home web server causing audio misfiring โ€ฆ and would mean, below, that โ€œastartโ€ is always โ€œ0โ€ and โ€œdelayโ€ should be set to the audio objectโ€™s duration parameter
  3. variables โ€œastartโ€ and โ€œdelayโ€ as per example โ€ฆ


    } else if (thingis.toLowerCase().indexOf('clock') != -1) {

    oaudio.src=audiomedia[i];

    astart=eval("3.1");

    delay=1.8;



    โ€ฆ where โ€œastartโ€ reflects a start of play value and โ€œdelayโ€ represents a length of play scenario in seconds, as we got going in the past when we presented Spliced Audio/Video Overlay Position Tutorial as shown below, where you can read more about the HTML5 Audio objects we used with this โ€œproof of conceptโ€ project

Please note with the recording of โ€œone_to_fiftynine.m4aโ€, that records numbers from 1 to 59, via QuickTime Player, we relied on the recording timer, to time our number recording with a second of duration to make the HTML and Javascript coding a lot easier!

So, as you can see, this is โ€œproof of conceptโ€ preparation, and of you want to try it yourself, perhaps youโ€™d like to start with a skeleton of todayโ€™s HTML and Javascript audio_1_59โšซhtml as a starting point?!


Previous relevant Spliced Audio/Video Overlay Position Tutorial is shown below.

Spliced Audio/Video Overlay Position Tutorial

Spliced Audio/Video Overlay Position Tutorial

Today weโ€™ve written a third draft of an HTML and Javascript web application that splices up to nine bits of audio or video or image input together, building on the previous Spliced Audio/Video/Image Overlay Tutorial as shown below, here, and that can take any of the forms โ€ฆ

  • audio file โ€ฆ and less user friendly is โ€ฆ
  • text that gets turned into speech via Google Translate (and user induced Text to Speech functionality), but needs your button presses
  • video
  • image โ€ฆ and background image for webpage

โ€ฆ for either of the modes of use, that being โ€ฆ

  • discrete โ€ฆ or โ€œOptionalโ€
  • synchronized โ€ฆ or โ€œOverlayโ€

โ€ฆ all like yesterday, but this time we allow you to โ€œseekโ€ or position yourself within the audio and/or video media. We still all โ€œfitโ€ this into GET parameter usage. Are you thinking we are a tad lazy with this approach? Well, perhaps a little, but it also means you can do this job just using clientside HTML and Javascript, without having to involve any serverside code like PHP, and in this day and age, people are much keener on this โ€œjust clientsideโ€ or โ€œjust client looking, plus, perhaps, Javascript serverside codeโ€ (ala Node.js) or perhaps โ€œJavascript clientside client code, plus Ajax methodologiesโ€. In any case, it does simplify design to not have to involve a serverside language like PHP โ€ฆ but please donโ€™t think we do not encourage you to learn a serverside language like PHP.

While we are at it here, we continue to think about the mobile device unfriendliness with our current web application, it being, these days, that the setting of the autoplay property for a media object is frowned upon regarding these mobile devices โ€ฆ for reasons of โ€œrunawayโ€ unknown charge issues as you can read at this useful link โ€ฆ thanks โ€ฆ and where they quote from Apple โ€ฆ

โ€œApple has made the decision to disable the automatic playing of video on iOS devices, through both script and attribute implementations.

In Safari, on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and auto-play are disabled. No data is loaded until the user initiates it.โ€ โ€“ Apple documentation.

A link weโ€™d like to thank regarding the new โ€œseekโ€ or media positioning functionality is this one โ€ฆ thanks.

Also, today, for that sense of symmetry, we start to create the Audio objects from now on using โ€ฆ



document.createElement("AUDIO");

โ€ฆ as this acts the same as new Audio() to the best of our testing.

For your own testing purposes, if you know of some media URLs to try, please feel free to try the โ€œoverlayโ€ of media ideas inherent in todayโ€™s splice_audioโšซhtm liveโœ‚run. For todayโ€™s cake โ€œprepared before the programโ€ weโ€™ve again channelled the GoToMeeting Primer Tutorial which had separate audio (albeit very short โ€ฆ sorry โ€ฆ but you get the gist) and video โ€ฆ well, below, you can click on the image to hear the presentation with audio and video synchronized, but only seconds 23 through to 47 of the video should play, and the presentation ending with the image below โ€ฆ

Click to see the audio and video played together synchronously

We think, though, that we will be back regarding this interesting topic, and hope we can improve mobile device functionality.


Previous relevant Spliced Audio/Video/Image Overlay Tutorial is shown below.

Spliced Audio/Video/Image Overlay Tutorial

Spliced Audio/Video/Image Overlay Tutorial

Today weโ€™ve written a second draft of an HTML and Javascript web application that splices up to nine bits of audio or video or image input together, building on the previous Splicing Audio Primer Tutorial as shown below, here, and that can take any of the forms โ€ฆ

  • audio file โ€ฆ and less user friendly is โ€ฆ
  • text that gets turned into speech via Google Translate (and user induced Text to Speech functionality), but needs your button presses
  • video
  • image โ€ฆ and background image for webpage

โ€ฆ for either of the modes of use, that being โ€ฆ

  • discrete โ€ฆ or โ€œOptionalโ€
  • synchronized โ€ฆ or โ€œOverlayโ€

The major new change here, apart from the ability to play two media files at once in our synchronized (or โ€œoverlayedโ€) way, is the additional functionality for Video, and we proceeded thinking thereโ€™d be an Javascript DOM OOPy method like โ€ฆ var xv = new Video(); โ€ฆ to allow for this, but found out from this useful link โ€ฆ thanks โ€ฆ that an alternative approach for Video object creation, on the fly, is โ€ฆ



var xv = document.createElement("VIDEO");

โ€ฆ curiously. And it took us a while to tweak to the idea that to have a โ€œdisplay homeโ€ for the video on the webpage we needed to โ€ฆ



document.body.appendChild(xv);

โ€ฆ which means you need to take care of any HTML form data already filled in, that isnโ€™t that formโ€™s default, when you effectively โ€œrefreshโ€ the webpage like this. Essentially though, media on the fly is a modern approach possible fairly easily with just clientside code. Cute, huh?!

Of course, what we still miss here, is the upload from a local place onto the web server, here at RJM Programming, capability, which we may consider in future, and that some of those other synchronization of media themed blog postings of the past, which you may want to read more, for this type of approach.

In the meantime, if you know of some media URLs to try, please feel free to try the โ€œoverlayโ€ of media ideas inherent in todayโ€™s splice_audioโšซhtm liveโœ‚run. Weโ€™ve thought of this one. Do you remember how the GoToMeeting Primer Tutorial had separate audio (albeit very short โ€ฆ sorry โ€ฆ but you get the gist) and video โ€ฆ well, below, you can click on the image to hear the presentation with audio and video synchronized, and the presentation ending with the image below โ€ฆ

Click to see the audio and video played together synchronously

We think, though, that we will be back regarding this interesting topic.


Previous relevant Splicing Audio Primer Tutorial is shown below.

Spliced Audio Primer Tutorial

Splicing Audio Primer Tutorial

Today weโ€™ve written a first draft of an HTML and Javascript web application that splices up to nine bits of audio input together that can take either of the forms โ€ฆ

  • audio file โ€ฆ and less user friendly is โ€ฆ
  • text that gets turned into speech via Google Translate (and user induced Text to Speech functionality), but needs your button presses

Do you remember, perhaps, when we did a series of blog posts regarding the YouTube API, that finished, so far, with YouTube API Iframe Synchronicity Resizing Tutorial? Well, a lot of what we do today is doing similar sorts of functionalities but just for Audio objects in HTML5. For help on this weโ€™d like to thank this great link. So rather than have HTML audio elements in our HTML, as we first shaped to do, weโ€™ve taken the great advice from this link, and gone all Javascript DOM OOPy on the task, to splice audio media together.

There were three thought patterns going on here for me.

  • The first was a simulation of those Sydney train public announcements where the timbre of the voice differs a bit between when they say โ€œPlatformโ€ and the โ€œ6โ€ (or whatever platform it is) that follows. This is pretty obviously computer audio โ€œbitsโ€ strung together โ€ฆ and wanted to get somewhere towards that capability.
  • The second one relates to presentation ideas following up on that โ€œonmouseoverโ€ Siri audio enhanced presentation we did at Apple iOS Siri Audio Commentary Tutorial. Well, we think we can do something related to that here, and weโ€™ve prepared this cake audio presentation here, for us, in advance โ€ฆ really, thereโ€™s no need for thanks.
  • The third concerns our eternal media file synchronization quests here at this blog that you may find of interest we hope, here.

Also of interest over time has been the Google Translate Text to Speech functionality that used to be very open, and we now only use around here in an interactive โ€œuser clicksโ€ way โ€ฆ but we still use it, because it is very useful, so, thanks. But trying to get this method working for โ€œPlatformโ€ and โ€œ6โ€ without a yawning gap in between ruins the spontaneity and fun somehow, but thereโ€™s nothing stopping you making your own audio files yourself as we did in that Siri tutorial called Apple iOS Siri Audio Commentary Tutorial and take the HTML and Javascript code you could call splice_audioโšซhtml from today, and go and make your own web application? Now, is there? Huh?

Try a liveโœ‚run or perhaps some more Siri cakes?!

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.


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.


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

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

Leave a Reply

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