From 1f63b4aff5dd8e738a4b6906c663d8717ccf0f15 Mon Sep 17 00:00:00 2001 From: Daniel Rossi Date: Wed, 11 Dec 2013 00:35:01 +1100 Subject: [PATCH] - fixes for #163 clear the stream on clip content within the playlist controller , there are two playlist replacement features to handle it in. --- .../org/flowplayer/controller/PlayListController.as | 11 +++++++++++ .../src/actionscript/org/flowplayer/model/Playlist.as | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) 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) {