diff --git a/core/src/actionscript/org/flowplayer/controller/PlayListController.as b/core/src/actionscript/org/flowplayer/controller/PlayListController.as index 978fcc0..9321e6f 100644 --- a/core/src/actionscript/org/flowplayer/controller/PlayListController.as +++ b/core/src/actionscript/org/flowplayer/controller/PlayListController.as @@ -67,6 +67,7 @@ package org.flowplayer.controller { flow_internal function setPlaylist(clips:Array):void { if (getState() != State.WAITING) { close(false); + clearStream(); } _playList.replaceClips2(clips); } @@ -328,10 +329,20 @@ package org.flowplayer.controller { } } + //#163 detach netstream on the current clip + private function clearStream():void + { + if (_playList.current && _playList.current.getContent() && _playList.current.getContent().hasOwnProperty("attachNetStream")) { + Object(_playList.current.getContent()).attachNetStream(null); + } + } + private function replacePlaylistAndPlay(clips:Object):void { //#163 stop the connection and stream _state.stop(true, true); + clearStream(); + if (clips is Clip) { _playList.replaceClips(clips as Clip); } else { diff --git a/core/src/actionscript/org/flowplayer/model/Playlist.as b/core/src/actionscript/org/flowplayer/model/Playlist.as index 6a632b4..0814c20 100644 --- a/core/src/actionscript/org/flowplayer/model/Playlist.as +++ b/core/src/actionscript/org/flowplayer/model/Playlist.as @@ -77,15 +77,10 @@ package org.flowplayer.model { doAddClip(clips[i], -1, false); } } - + private function doReplace(newClips:Array, silent:Boolean = false):void { var oldClips:Array = _clips.concat([]); - //#163 detach netstream on the current clip - if (_clips[_currentPos] && _clips[_currentPos].getContent().hasOwnProperty("attachNetStream")) { - _clips[_currentPos].getContent().attachNetStream(null); - } - initialize(newClips); if (! silent) {