Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var thisM = Media.get(id);
// if Media was released, then node will be null and we need to create it again
if (!thisM.node) {
args[2] = true; // Setting createAudioNode to true
if (!module.exports.create(win, lose, args)) {
// there is no reason to continue if we can't create media
// corresponding callback has been invoked in create so we don't need to call it here
return;
}
}
try {
thisM.node.play();
} catch (err) {
if (lose) {
lose({code:MediaError.MEDIA_ERR_ABORTED});
}
}
},
function () {
audioObjects[id].pause();
if (audioObjects[id].currentTime !== 0)
audioObjects[id].currentTime = 0;
console.log("media::onStalled() - MEDIA_ERROR -> " + MediaError.MEDIA_ERR_ABORTED);
var err = new MediaError(MediaError.MEDIA_ERR_ABORTED, "Stalled");
Media.onStatus(id, Media.MEDIA_ERROR, err);
},
2000);