 
         public function appendTags(fragmentType : int, fragLevel : int, fragSN : int, tags : Vector.<FLVTag>, min_pts : Number, max_pts : Number, continuity : int, startPosition : Number) : void {
             // compute playlist sliding here :  it is the difference between  expected start position and real start position
-            var sliding:Number = 0, _nextRelativeStartPos: Number = startPosition + (max_pts - min_pts) / 1000, headerAppended : Boolean = false, metaAppended : Boolean = false;
+            var sliding:Number;
+            var nextRelativeStartPos: Number = startPosition + (max_pts - min_pts) / 1000;
+            var headerAppended : Boolean = false, metaAppended : Boolean = false;
             // compute sliding in case of live playlist, or in case of VoD playlist that slided in the past (live sliding ended playlist)
-            if(_hls.type == HLSTypes.LIVE  || _playlistSlidingMain || _playlistSlidingAltAudio) {
-                if(fragmentType == HLSLoaderTypes.FRAGMENT_MAIN) {
-                    // if -1 : it is not the first appending for this fragment type : we can compute playlist sliding
-                    if(_nextExpectedAbsoluteStartPosMain !=-1) {
-                        sliding = _playlistSlidingMain = _nextExpectedAbsoluteStartPosMain - startPosition;
-                    }
-                    _nextExpectedAbsoluteStartPosMain = _nextRelativeStartPos + sliding;
-                } else if(fragmentType == HLSLoaderTypes.FRAGMENT_ALTAUDIO) {
-                    // if -1 : it is not the first appending for this fragment type : we can compute playlist sliding
-                    if(_nextExpectedAbsoluteStartPosAltAudio !=-1) {
-                        sliding = _playlistSlidingAltAudio = _nextExpectedAbsoluteStartPosAltAudio - startPosition;
-                    }
-                    _nextExpectedAbsoluteStartPosAltAudio = _nextRelativeStartPos + sliding;
-                }
-            }
+            var computeSliding : Boolean = (_hls.type == HLSTypes.LIVE  || _playlistSlidingMain || _playlistSlidingAltAudio);
 
             var fragIdx : int;
             if(fragmentType == HLSLoaderTypes.FRAGMENT_MAIN) {
+                sliding = _playlistSlidingMain;
+                // if a new fragment is being appended
                 if(fragLevel != _fragMainLevel || fragSN != _fragMainSN) {
                     _fragMainLevel = fragLevel;
                     _fragMainSN = fragSN;
                     _fragMainIdx++;
+                    // compute sliding if needed
+                    if(computeSliding) {
+                        // if -1 : it is not the first appending for this fragment type : we can compute playlist sliding
+                        if(_nextExpectedAbsoluteStartPosMain !=-1) {
+                            // if same continuity counter, sliding can be computed using PTS, it will be more accurate
+                            if(continuity == _fragMainInitialContinuity) {
+                                sliding = _playlistSlidingMain = _fragMainInitialStartPosition + (min_pts-_fragMainInitialPTS)/1000 - startPosition;
+                            } else {
+                                sliding = _playlistSlidingMain = _nextExpectedAbsoluteStartPosMain - startPosition;
+                            }
+                        } else {
+                            _fragMainInitialStartPosition = startPosition;
+                            _fragMainInitialPTS = min_pts;
+                            _fragMainInitialContinuity = continuity;
+                        }
+                        _nextExpectedAbsoluteStartPosMain = nextRelativeStartPos + sliding;
+
+                    }
                     CONFIG::LOGGING {
-                        Log.debug('new main frag,start/sliding/idx:' + startPosition + '/' + sliding + '/' + _fragMainIdx);
+                        Log.debug('new main frag,start/sliding/idx:' + startPosition.toFixed(3) + '/' + sliding.toFixed(3) + '/' + _fragMainIdx);
                     }
                 }
                 fragIdx = _fragMainIdx;
             } else {
+                sliding = _playlistSlidingAltAudio;
+                // if a new fragment is being appended
                 if(fragLevel != _fragAltAudioLevel || fragSN != _fragAltAudioSN) {
                     _fragAltAudioLevel = fragLevel;
                     _fragAltAudioSN = fragSN;
                     _fragAltAudioIdx++;
+                    // compute sliding if needed
+                    if(computeSliding) {
+                        // if -1 : it is not the first appending for this fragment type : we can compute playlist sliding
+                        if(_nextExpectedAbsoluteStartPosAltAudio !=-1) {
+                            // if same continuity counter, sliding can be computed using PTS, it will be more accurate
+                            if(continuity == _fragAltAudioInitialContinuity) {
+                                sliding = _playlistSlidingAltAudio = _fragAltAudioInitialStartPosition + (min_pts - _fragAltAudioInitialPTS)/1000 - startPosition;
+                            } else {
+                                sliding = _playlistSlidingAltAudio = _nextExpectedAbsoluteStartPosAltAudio - startPosition;
+                            }
+                        } else {
+                            _fragAltAudioInitialStartPosition = startPosition;
+                            _fragAltAudioInitialPTS = min_pts;
+                            _fragAltAudioInitialContinuity = continuity;
+                        }
+                        _nextExpectedAbsoluteStartPosAltAudio = nextRelativeStartPos + sliding;
+                    }
                     CONFIG::LOGGING {
                         Log.debug('new altaudio frag,start/sliding/idx:' + startPosition + '/' + sliding + '/' + _fragAltAudioIdx);
                     }

                // find last video keyframe before clipping_position : loop through header tags and find last AVC_HEADER before clipping position
                for each (var data : FLVData in _headerTags) {
                    if ((data.positionAbsolute - _playlistSlidingMain ) <= clipping_position0 && data.tag.type == FLVTag.AVC_HEADER) {
                        clipping_position = data.positionAbsolute;
                    }
                }



            CONFIG::LOGGING {
                if (clipped_tags > 0) {
                    Log.debug2("clipped " + clipped_tags + " tags, clipping_position0/clipping_position/position/new backBufferLength :" + clipping_position0.toFixed(3) + '/' + clipping_position.toFixed(3) + '/' + position.toFixed(3) + '/'  + (position-clipping_position).toFixed(3));
                }
            }
        }
