Posts

Angular is trash

Did I hear somebody say overhead? Fuck Javascript. WTF is this code? // logger.js ( function () { ' use strict ' ; angular . module ( ' app ' ) . factory ( ' logger ' , logger); function logger () { } })(); // storage.js ( function () { ' use strict ' ; angular . module ( ' app ' ) . factory ( ' storage ' , storage); function storage () { } })();     This is incredibly ugly. How can somebody even stand looking at these piles of brackets, semicolons, weird ass commands like 'use strict', a dollar sign before the variable name. Who in their right mind likes this trash?       var sharedServicesModule = angular . module ( 'sharedServices' , [ ] ) ; sharedServices . service ( 'NetworkService' , function ( $http ) { } ) ; var loginModule = angular . module ( 'login' , [ 'sharedServices' ] ) ; loginModule . service ( ...

[CoffeeScript] Polyfill for missing bind() in PhantomJS

Did receive unexplicable errors when running JS tests through Karma on a PhantomJS server, like: TypeError: 'undefined' is not a function (evaluating 'this.proxy[method].bind(this.proxy)') Looks like the problem is that PhantomJS is built with an old version of the JavaScript core where the bind method is not part of the Function prototype. There's a polyfill for that further down this page. That adds the method to the Function prototype. Here now is the same translated to CoffeeScript: if !Function::bind   Function::bind = (oThis) ->     if typeof @ != 'function'       throw new TypeError 'Function.prototype.bind - what is trying to be bound is not callable'     aArgs   = [       Array::slice.call(arguments, 1),       fToBind = this,       fNOP    = ->,       fBound  = ->  ...

Reactivating NPAPI in Google Chrome (until September 2015)

For testing purposes I wanted to activate the default flash system player in Chrome://plugins but to my surprise didn't find it in the list. According to this entry NPAPI plugin support in Chrome will be completely removed from September 2015. See here Until then NPAPI support can be manually turned back on by typing this in the address bar: chrome://flags/#enable-npapi After a restart the NPAPI flash plugin can be used again. Apart from that a content debugger PPAPI version is available for download from here: http://labs.adobe.com/downloads/flashplayer.html

Akamai HLS live stream with AkamaiAdvancedStreamingPlugin

Akamai gave me a hard time making a live stream from their servers work in my flash video player. Originally I've been testing my streams in their stream testing app @ mediapm.edgesuite.net. Saw a &hdcore=3.3.0 parameter and some random string getting attached to the manifest.f4m request URL and after adding these parameters manually to mine the stream played fine in both Firefox and Chrome. That was never properly tested in Safari though and about a month later someone complained they couldn't see the stream. For Safari, the akamai streaming server would block requests to the segment files with a 403 - Forbidden. Talking to a dude at Akamai they provided me with libraries and a documentation file to integrate their AkamaiAdvancedStreamingPlugin in my project. The docs were outdated and incomplete, the samples provided wouldn't compile because the maven repository server at mvn.akamai.com could at the time of writing this not be resolved. Following the docs you...

Erasing parts of a Bitmap: bitmapData.draw with BlendMode.ERASE turns erased areas black instead of transparent

Been trying to erase areas of a Bitmap using a circle-type Sprite. Worked using the Sprite on the bitmap's bitmapData.draw method but for some reason instead of making the areas I've been deleting transparent, they'd just turn black. Problem was I was using a JPG without alpha layer which obviously couldn't have any transparency. Solution was I would transfer the JPG bitmapData into a new bitmap that had an extra alpha layer with transparency on. This was achieved by creating a new BitmapData with true as transparency value and adding a 8-digit color value for fillColor:uint parameter. [Embed(source="image.jpg",mimeType="image/jpeg")] private var bmp:Class; private var drawOn:Bitmap; var bmpd:BitmapData = new BitmapData(1280,780,true,0x00000000); bmpd.draw( new bmp ); drawOn = new Bitmap(bmpd); I could drawOn.bitmapData.draw( myBrushSprite, etc...) now with transparency. Had some nasty looking edges around my brush sprite which disappeare...

Air 3.5 & ios 6 - StageOrientation events firing only up&down

Recently updated my iOS app to use AIR 3.5 sdk - noticed my app wouldn't auto-orient sideways anymore. Only a complete flip would trigger stageOrientationChange events. In the app-descriptor xml I had the line <aspectRatio>portrait</aspectRatio> After deleting this, auto-orientation worked in every direction again. The behaviour is intentional, see: http://blogs.adobe.com/airodynamics/2012/05/22/stage-aspectratio-enhancements/

Play M3U8 HTTP Stream through Flash Player using apple-http-osmf

Tried getting my video player to play back Apple m3u8 formatted dynamic stream. After some hassle with the apple-http-osmf component which reads in m3u8 files and prepares them for playback with OSMF I ended up hearing the sound, not the seeing video. I had been using the MediaPlayer and MediaPlayerSprite classes so far. After reading this issue I switched to using the HTTPNetStream class, as dani at electroteque.net used that to successfully build a HLS plugin for the Flowplayer . Now my stream is played back through a regular flash.net.NetConnection. In order to make it work you need the latest sources from apple-http-osmf and the osmf player 2.0 If you get the "Error: Quality level cannot be set at this time." - just comment that line out in HTTPStreamSource.as:330. Also you want to make sure that within at.matthew.httpstreaming.HTTPStreamingM3U8Handler.as the RATES_READY event is fired before the INDEX_READY event. See the working source below or do...