             return levels;
         }
 
+        private static function hola_hls_get_current_fragment(): String
+        {
+            return _currentFrag;
+        }
+
         private static function hola_hls_get_levels_async(): void
-	{
-	    setTimeout(function(): void
-	    {
+        {
+            setTimeout(function(): void
+            {
                 var levels: Array = [];
                 for (var i: int = 0; i<_hls.levels.length; i++)
                     levels.push(level_to_object(_hls.levels[i]));
-		JSAPI.postMessage('flashls.hlsAsyncMessage', {type: 'get_levels', msg: levels});
-	    }, 0);
-        }	
-
-        private static function hola_hls_get_segment_info(url:String):Object{
-            for (var i:int = 0; i<_hls.levels.length; i++)
+                JSAPI.postMessage('flashls.hlsAsyncMessage', {type: 'get_levels', msg: levels});
+            }, 0);
+        }
+
+        private static function hola_hls_get_segment_info(url: String): Object
+        {
+            for (var i: int = 0; i<_hls.levels.length; i++)
             {
-                var l:Level = _hls.levels[i];
+                var l: Level = _hls.levels[i];
                 for (var j:int = 0; j<l.fragments.length; j++)
                 {
                     if (url==l.fragments[j].url)


    public class HLSJS
    {
        private static var _inited:Boolean = false;
        private static var _duration:Number;
        private static var _bandwidth:Number = -1;
        private static var _url:String;
        private static var _state:String;
        private static var _hls:HLS;
	private static var _silence: Boolean = false;

        public static function init():void{
            if (_inited || !ZExternalInterface.avail())

            ExternalInterface.addCallback("hola_hls_get_type",
                hola_hls_get_type);
            ExternalInterface.addCallback("hola_hls_load_fragment", hola_hls_load_fragment);
            ExternalInterface.addCallback("hola_hls_abort_fragment", hola_hls_abort_fragment);
            ExternalInterface.addCallback("hola_hls_load_level", hola_hls_load_level);
            ExternalInterface.addCallback('hola_hls_flush_stream', hola_hls_flush_stream);
        }

        public static function HLSnew(hls:HLS):void{
            _hls = hls;
            _state = HLSPlayStates.IDLE;
            // track duration events
            hls.addEventListener(HLSEvent.PLAYLIST_DURATION_UPDATED,
                on_playlist_duration_updated);
            // track playlist-url/state
            hls.addEventListener(HLSEvent.PLAYBACK_STATE, on_playback_state);
            hls.addEventListener(HLSEvent.SEEK_STATE, on_seek_state);
            hls.addEventListener(HLSEvent.MANIFEST_LOADED, on_manifest_loaded);
            hls.addEventListener(HLSEvent.MANIFEST_LOADING, on_manifest_loading);
            hls.addEventListener(HLSEvent.FRAGMENT_LOADING, on_fragment_loading);
            // notify js events
            hls.addEventListener(HLSEvent.MANIFEST_LOADING, on_event);
            hls.addEventListener(HLSEvent.MANIFEST_PARSED, on_event);
