 
         /** Reference to the HLS controller. **/
         private var _hls:HLS;
-        /** Reference to the manifest levels. **/
-        private var _levels:Array;
         /** switch up threshold **/
         private var _switchup:Array = null;
         /** switch down threshold **/
         private var _switchdown:Array = null;
+        /** bitrate array **/
+        private var _bitrate:Array = null;
+        /** nb level **/
+        private var _nbLevel:Number = 0;
+        /** lowest non audio level **/
+        private var _lowestNonAudioLevel:Number = -1;
 
         /** Create the loader. **/
         public function AutoLevelManager(hls:HLS):void {

               or buffer time is too small to retrieve one fragment with current level
            */

            else if(current_level > 0 &&((fetchratio < (1-_switchdown[current_level])) || (bufferratio < 1)) ) {
                  //Log.txt("bufferratio < 2 || fetchratio: < 1-_switchdown[_level]="+(1-_switchdown[_level]));
                  /* find suitable level matching current bandwidth, starting from current level
                     when switching level down, we also need to consider that we might need to load two fragments.

                    ensures that buffer time is bigger than than the time to download 2 fragments from level j, if we keep same bandwidth
                  */
                  for(var j:Number = current_level-1; j > 0; j--) {
                     if( _bitrate[j] <= last_bandwidth && (bufferratio > 2*_bitrate[j]/last_bandwidth)) {
                          Log.txt("switch to level " + j);
                          return j;
                      }
