Twitter Facebook Google+ YouTube Pinterest github

test html5 for streaming audio

    var mytestaudio = document.createElement('audio');

    var playMsg = mytestaudio.canPlayType('audio/mp4; codecs="mp4a.40.5"'); 
    if ("" != playMsg) {
        alert("aac is " + playMsg + " supported - fallback to mp3");
        myaudio = new Audio("...source-url.mp3");
    } else {
        myaudio = new Audio("...source-url.aac");
    ...proceed with eventhandlers for pause(), play(), etc...

use case:
- Some Android mobile devices cannot play a .aac (better quality, smaller compression) stream, so we have to fall back to a .mp3 stream.
- this was for a phonegap/cordova mobile app built using HTML CSS javascript
- custom phonegap plugin written to be able to play iOS streaming audio in the background while phone is locked
- if you want to control audio in javascript and provide an alternate source file.


what are you living for…?

I’ve always loved Francis Chan, I’ve read two of his books, and while they are great, he has a way of illustrating basic truths when he teaches.


adding DFP ads to phonegap / cordova mobile app

So lets say that:

  • you are building a hybrid mobile application targeted for the iOS and Android platforms.
  • you want the app to be powered by Advertisements. – a popular option would be to use Google’s DoubleClick For Publishers (DFP) or DFA for non-publishers
Side plug: We implemented DFP for our friends at The Daily Tea. 
But that was a website - yes responsive, but the ads and content were intended for a browser.

Using DFP’s prescribed javascript implementation dumps an iframe onto your app – similar to other ad platforms as well.

Please note: I am writing about a HTML/(Angular)JS/CSS app – built to be compiled to native!

Mo Problems:

- An iframe in your mobile [web] app is a problem because hybrid HTML5/JS/CSS apps packaged using cordova/phongap essentially create browser web-views which you navigate and manage state.

When you click on the DFP link (rendered) in an iframe, it will load the ad href above your app, and your users are stuck on that ad’s destination with no way to return to your app.

- An iframe in your web app is a problem because you cannot (as far as I know) use the inAppBrowser plugin to target the ad href to open the default system browser on your Android or iOS app!

- An iframe in your web app is a problem because you’d have to use a setTimeout to detect (after the fact) if the ad unit returned a valid asset.

So the work around for a DFP implementation is a little tricky.

I stumbled across this Google article: Simplified URL tags for mobile, and it was EXACTLY what I was looking for:

You can use simplified URLs in the following cases:
  • Environments where devices don't support JavaScript tags.
  • As redirects for trafficking on other ad servers.
  • Applications where an SDK is not provided, such as BlackBerry.

With a URL like: “×50&c=12345“, I’m now able to capture a click and use inAppBrowser to open in the device’s default browser, however the link didn’t fully resolve to the final ad asset – browser security restriction with cookies blocked the redirection. It always ended up as: “”

If you are still reading, you must be facing this same same problem, and I feel your pain… seriously contact me, I’d be glad to help, but here is how I finally un-wrangled it

The key is the ‘adx’ request-type section of the URL:

adx: Returns the raw code of the creative trafficked in DFP.
 If the request URL contains /adx, the ad server returns returns a creative 
without any rendering code wrapping it. 
This is useful when there is special rendering that needs to be handled by the client, 
such as for a video player.
Example request URL:


- get the ad asset, using ‘adx’ param
- parse the response and look for the image and destination url
- render your own ad


 $scope.getRandomSpan = function() {
    return Math.floor((Math.random() * 99999) + 1);
 $scope.randomNumberForAds = $scope.getRandomSpan(); //for Correlator/cache-busting parameter
 $scope.adurl = "";
 $scope.adImageSrc = "";
 $scope.openAd = function() {
    if ($scope.adurl) {$scope.adurl, "_system"); //using inAppbrowser plugin
//ng-hide ad section in the footer if offline
$scope.isOffline = 'onLine' in navigator && !navigator.onLine;
if (!$scope.isOffline) {
     method: 'GET',
     url: "" + $scope.randomNumberForAds
   }).success(function(data, status, headers, config) {
      var doc = document.createElement("html");
      doc.innerHTML = data;
      var links = doc.getElementsByTagName("a")
      var urls = [];
      for (var i = 0; i < links.length; i++) {
      $scope.adurl = urls[0];
      var imgs = doc.getElementsByTagName("img");
      var imgSrcs = [];
      for (var i = 0; i < imgs.length; i++) {
      $scope.adImageSrc = imgSrcs[0];
   }).error(function(data, status, headers, config) {
    $scope.isOffline = true;


 <div id='div-gpt-ad-blablabla' style='width:100%; height:50px;' ng-hide="isOffline">
    <a style='width: 320px;height: 50px;display: block;margin: 0 auto;' href='#' ng-click='openAd();'>
       <img width="320" height="50" ng-src="{{adImageSrc}}">

(sorry about indentation and formatting ( I need some sleep )

wanted to share this while it was still fresh, and hopefully you do not battle this for weeks on end!

Good luck to you!

Learning about marketing and selling

What is Marketing?
– Storytelling!

– Hello world, this is me|us: who we are.
– We do ____ superbly well: what we do.
– We do ____ differently: how we do it.
– why/how/where we got started: purpose.
– what makes us tick: passion.
– our vision: big hairy audacious goal, i.e. why we will last.
– what/where/with-whom we are doing today/tomorrow: next steps.

Tailor this to the medium/context/outlet you are reaching out to.
(example medium: audio/written)
(example context: anniversary/grand-opening)
(example outlet: web/billboard/magazine)

What is Selling?
– Storytelling with the customer/prospect as the hero/focus/center!

– Should be tailored storytelling for each customer/prospect.

Marketing + Selling:
– What is your story?
– Who is your ideal prospect?
– If you have a good story, don’t be afraid to tell it to your ideal person.

…in progress.


what we are about

An introduction to AfroApparel

honor each hour of the day!

– @mdmnky


Today, April 4th 2014, I resign from my job at Comcast Interactive Media (CIM –

I leave behind many wonderful, intelligent, compassionate, intense, beautiful, … colleagues! But I take along with me loving, brilliant, and caring friends!

The decision to leave was NOT easy, but I feel it was necessary.

My wife says to me this morning:

“I love you, and I trust you”.

She says this after I just removed the warm, comforting blanket that is a stable salary. After I forfeit a significant financial amount of money that sits, yet to be vested, in a growing company’s stock. I am walking away from a good company, good pay, good benefits, good projects, good atmosphere, good colleagues, good all around. I would even highly recommend a job with Comcast, because the leadership is smart, and they “get it”. It is indeed a great place to work.

There is a proverb that says: “It takes a village to raise a child”, and my CIM village has been tremendous! I have learned a ton, grown by leaps-and-bounds, failed at scale, succeeded with my small team, received phenomenal advice, counseled with many, cried with some, and will be building with others.

My reason for leaving, I tell everyone, is to be closer to my family; and that is the truth. The truth is that, for me, my work-life balance was skewed, I was not enjoying my family as I should, and I couldn’t immerse myself in my work because of the commute.

So I am going to work from home to focus on my freelance practice with Cast and Crew (, and help people develop stellar – web, mobile, design, and community – projects.

I would add to that proverb: “It also takes a village to grow an adult.” As I return back to working from home, I want to connect again with my community here in Reading, PA – Lord knows that I need the support, camaraderie, accountability, and friendship. I want to help people with their projects, I want to build small and scale up, I want to help people define/refine their ideas and dreams, but ultimately I want to help people make money and grow their business!

Yes, I am nervous/excited/anxious/apprehensive/insert-intense-emotion-here, but you know what…? God is ultimately in control. My wife and I have done the work of stripping down to the bare minimum, we’ve paid down all our consumer debt, saved a little, and we are on the same page.

And so begins the epic journey…


Hat tip to John Mark McMillan for the post title from the song:

beware of the imposter

I am an imposter!

That’s when you’re pretty sure that all the other coders you work with are smarter, more talented and more skilled than you are. You live in fear that people will discover that you are really faking your smarts or skills or accomplishments.

Guilty as charged!

I just really wish we lived in a society where we didn’t define ourselves so strongly by our day jobs and where working ourselves to death wasn’t seen as a virtue.

This all comes from an article titled: “The Stress Of Being A Computer Programmer Is Literally Driving Many Of Them Crazy

This is an important discovery/admission in my quest towards minimalism.

What is next? I am pretty sure I know what I need to do next… stay tuned.

the best type of award…

so proud

so proud

what turning 30 is doing to me

I turned 30 on June 8th 2013. Almost immediately I felt this “thing” click internally. I’ve been struggling to put this “feeling” into words.

My best friend Obi (who also turned 30 a few months prior) and I had a long conversation about this “feeling/thing”. The conversation had phrases like “less time for bullshit” or “more focused”, “more purposeful in pursuit”, etc.

Alas, I have a explanation of what turning 30 is doing to me, and perhaps Obi as well… it is forcing me to adopt minimalism:

Minimalism is a lifestyle that helps people question what things add value to their lives. By clearing the clutter from life’s path, we can all make room for the most important aspects of life: health, relationships, passion, growth, and contribution.

via The Minimalists Pitch

I only realized this after a friend directed me to The Minimalists and their definition of minimalism.

My flavor of minimalism though will be centered around my faith and my family! I will try to do a better job of documenting this journey, perhaps it will help someone else?

Did turning 30 have a similar effect on you?