Skip to content

Commit 4b6bc17

Browse files
committed
Handled empty playProps
1 parent ae744ad commit 4b6bc17

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/soundjs/Sound.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ this.createjs = this.createjs || {};
13701370
var defaultPlayProps = s._defaultPlayPropsHash[instance.src] || {};
13711371
if (playProps.interrupt == null) {playProps.interrupt = defaultPlayProps.interrupt || s.defaultInterruptBehavior};
13721372
if (playProps.delay == null) {playProps.delay = defaultPlayProps.delay || 0;}
1373-
if (playProps.offset == null) {playProps.offset = instance.getPosition();}
1373+
if (playProps.offset == null) {playProps.offset = instance.position;}
13741374
if (playProps.loop == null) {playProps.loop = instance.loop;}
13751375
if (playProps.volume == null) {playProps.volume = instance.volume;}
13761376
if (playProps.pan == null) {playProps.pan = instance.pan;}
@@ -1698,8 +1698,8 @@ this.createjs = this.createjs || {};
16981698
}
16991699

17001700
// Audio is a better candidate than the current target, according to playhead
1701-
if ((interrupt == Sound.INTERRUPT_EARLY && target.getPosition() < replacement.getPosition()) ||
1702-
(interrupt == Sound.INTERRUPT_LATE && target.getPosition() > replacement.getPosition())) {
1701+
if ((interrupt == Sound.INTERRUPT_EARLY && target.position < replacement.position) ||
1702+
(interrupt == Sound.INTERRUPT_LATE && target.position > replacement.position)) {
17031703
replacement = target;
17041704
}
17051705
}

src/soundjs/data/PlayPropsConfig.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ this.createjs = this.createjs || {};
153153
* @static
154154
*/
155155
s.create = function (value) {
156-
if (value instanceof s || value instanceof Object) {
156+
if (value == null || value instanceof s || value instanceof Object) {
157157
var ppc = new createjs.PlayPropsConfig();
158158
ppc.set(value);
159159
return ppc;
160-
} else {
161-
throw new Error("Type not recognized.");
160+
} else if (value == null) {
161+
throw new Error("PlayProps configuration not recognized.");
162162
}
163163
};
164164

@@ -175,7 +175,9 @@ this.createjs = this.createjs || {};
175175
* @return {PlayPropsConfig} Returns the instance the method is called on (useful for chaining calls.)
176176
*/
177177
p.set = function(props) {
178-
for (var n in props) { this[n] = props[n]; }
178+
if (props != null) {
179+
for (var n in props) { this[n] = props[n]; }
180+
}
179181
return this;
180182
};
181183

0 commit comments

Comments
 (0)