Skip to content

Commit

Permalink
Merge pull request Dash-Industry-Forum#1069 from bbcrddave/localStora…
Browse files Browse the repository at this point in the history
…geSettingsKeyUndefined

Use correct key when saving settings to local storage
  • Loading branch information
Dan Sparacio authored and Dan Sparacio committed Jan 27, 2016
2 parents 5f36c29 + 582f9d1 commit d00e4fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/streaming/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,6 @@ function MediaPlayer() {

mediaController.initialize();
mediaController.setConfig({
DOMStorage: domStorage,
errHandler: errHandler
});

Expand Down
14 changes: 6 additions & 8 deletions src/streaming/controllers/MediaController.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import EventBus from '../../core/EventBus.js';
import FactoryMaker from '../../core/FactoryMaker.js';
import Debug from '../../core/Debug.js';
import TextSourceBuffer from '../TextSourceBuffer.js';
import DOMStorage from '../utils/DOMStorage.js';

const TRACK_SWITCH_MODE_NEVER_REPLACE = 'neverReplace';
const TRACK_SWITCH_MODE_ALWAYS_REPLACE = 'alwaysReplace';
Expand All @@ -46,14 +47,14 @@ function MediaController() {
let log = Debug(context).getInstance().log;
let eventBus = EventBus(context).getInstance();
let textSourceBuffer = TextSourceBuffer(context).getInstance();
let domStorage = DOMStorage(context).getInstance();

let instance,
tracks,
initialSettings,
selectionMode,
switchMode,
errHandler,
DOMStorage;
errHandler;

function initialize() {
tracks = {};
Expand All @@ -73,7 +74,7 @@ function MediaController() {
var tracks = [];

if (!settings) {
settings = DOMStorage.getSavedMediaSettings(type);
settings = domStorage.getSavedMediaSettings(type);
setInitialSettings(type, settings);
}

Expand Down Expand Up @@ -305,9 +306,6 @@ function MediaController() {
if (config.errHandler) {
errHandler = config.errHandler;
}
if (config.DOMStorage) {
DOMStorage = config.DOMStorage;
}
}

/**
Expand All @@ -319,7 +317,7 @@ function MediaController() {
}

function storeLastSettings(type, value) {
if (DOMStorage.isSupported(DOMStorage.STORAGE_TYPE_LOCAL) && (type === 'video' || type === 'audio')) {
if (domStorage.isSupported(DOMStorage.STORAGE_TYPE_LOCAL) && (type === 'video' || type === 'audio')) {
localStorage.setItem(DOMStorage['LOCAL_STORAGE_' + type.toUpperCase() + '_SETTINGS_KEY'], JSON.stringify({settings: value, timestamp: new Date().getTime()}));
}
}
Expand Down Expand Up @@ -486,4 +484,4 @@ factory.TRACK_SWITCH_MODE_ALWAYS_REPLACE = TRACK_SWITCH_MODE_ALWAYS_REPLACE;
factory.TRACK_SELECTION_MODE_HIGHEST_BITRATE = TRACK_SELECTION_MODE_HIGHEST_BITRATE;
factory.TRACK_SELECTION_MODE_WIDEST_RANGE = TRACK_SELECTION_MODE_WIDEST_RANGE;
factory.DEFAULT_INIT_TRACK_SELECTION_MODE = DEFAULT_INIT_TRACK_SELECTION_MODE;
export default factory;
export default factory;

0 comments on commit d00e4fe

Please sign in to comment.