Skip to content

Commit

Permalink
add resetInitialSettings function for Stream. It has to be called by …
Browse files Browse the repository at this point in the history
…setup and reset functions
  • Loading branch information
nicosang committed Jun 21, 2017
1 parent 1e3208a commit f91b4db
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/streaming/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ function Stream(config) {
trackChangedEvent;

function setup() {
streamProcessors = [];
isStreamActivated = false;
isMediaInitialized = false;
streamInfo = null;
updateError = {};
isUpdating = false;
resetInitialSettings();

liveEdgeFinder = LiveEdgeFinder(context).getInstance();
fragmentController = FragmentController(context).create({
Expand Down Expand Up @@ -130,7 +125,7 @@ function Stream(config) {
* @memberof Stream#
*/
function deactivate() {
let ln = streamProcessors.length;
let ln = streamProcessors ? streamProcessors.length : 0;
for (let i = 0; i < ln; i++) {
streamProcessors[i].reset();
}
Expand All @@ -141,6 +136,13 @@ function Stream(config) {
eventBus.off(Events.CURRENT_TRACK_CHANGED, onCurrentTrackChanged, instance);
}

function resetInitialSettings() {
deactivate();
streamInfo = null;
updateError = {};
isUpdating = false;
}

function reset() {

if (playbackController) {
Expand All @@ -153,7 +155,7 @@ function Stream(config) {
fragmentController = null;
}

deactivate();
resetInitialSettings();
mediaController = null;
abrController = null;
manifestUpdater = null;
Expand All @@ -162,8 +164,6 @@ function Stream(config) {
capabilities = null;
log = null;
errHandler = null;
isUpdating = false;
updateError = {};

eventBus.off(Events.DATA_UPDATE_COMPLETED, onDataUpdateCompleted, instance);
eventBus.off(Events.BUFFERING_COMPLETED, onBufferingCompleted, instance);
Expand Down

0 comments on commit f91b4db

Please sign in to comment.