|
@@ -67397,9 +67397,6 @@ var BABYLON;
|
|
catch (e) {
|
|
catch (e) {
|
|
// protect error during capability check.
|
|
// protect error during capability check.
|
|
}
|
|
}
|
|
- if (/iPad|iPhone|iPod/.test(navigator.platform)) {
|
|
|
|
- this._unlockiOSaudio();
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
Object.defineProperty(AudioEngine.prototype, "audioContext", {
|
|
Object.defineProperty(AudioEngine.prototype, "audioContext", {
|
|
/**
|
|
/**
|
|
@@ -67433,31 +67430,6 @@ var BABYLON;
|
|
AudioEngine.prototype.unlock = function () {
|
|
AudioEngine.prototype.unlock = function () {
|
|
this._triggerRunningState();
|
|
this._triggerRunningState();
|
|
};
|
|
};
|
|
- AudioEngine.prototype._unlockiOSaudio = function () {
|
|
|
|
- var _this = this;
|
|
|
|
- this._displayMuteButton(true);
|
|
|
|
- var unlockaudio = function () {
|
|
|
|
- if (!_this.audioContext) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- var buffer = _this.audioContext.createBuffer(1, 1, 22050);
|
|
|
|
- var source = _this.audioContext.createBufferSource();
|
|
|
|
- source.buffer = buffer;
|
|
|
|
- source.connect(_this.audioContext.destination);
|
|
|
|
- source.start(0);
|
|
|
|
- setTimeout(function () {
|
|
|
|
- if ((source.playbackState === source.PLAYING_STATE || source.playbackState === source.FINISHED_STATE)) {
|
|
|
|
- _this._triggerRunningState();
|
|
|
|
- if (_this._muteButton) {
|
|
|
|
- _this._muteButton.removeEventListener('touchend', unlockaudio, false);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }, 0);
|
|
|
|
- };
|
|
|
|
- if (this._muteButton) {
|
|
|
|
- this._muteButton.addEventListener('touchend', unlockaudio, false);
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
AudioEngine.prototype._resumeAudioContext = function () {
|
|
AudioEngine.prototype._resumeAudioContext = function () {
|
|
if (this._audioContext.resume) {
|
|
if (this._audioContext.resume) {
|
|
this._audioContext.resume();
|
|
this._audioContext.resume();
|
|
@@ -67511,9 +67483,8 @@ var BABYLON;
|
|
this.onAudioLockedObservable.notifyObservers(this);
|
|
this.onAudioLockedObservable.notifyObservers(this);
|
|
this._displayMuteButton();
|
|
this._displayMuteButton();
|
|
};
|
|
};
|
|
- AudioEngine.prototype._displayMuteButton = function (iOS) {
|
|
|
|
|
|
+ AudioEngine.prototype._displayMuteButton = function () {
|
|
var _this = this;
|
|
var _this = this;
|
|
- if (iOS === void 0) { iOS = false; }
|
|
|
|
if (this.useCustomUnlockedButton) {
|
|
if (this.useCustomUnlockedButton) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -67528,11 +67499,12 @@ var BABYLON;
|
|
document.getElementsByTagName('head')[0].appendChild(style);
|
|
document.getElementsByTagName('head')[0].appendChild(style);
|
|
document.body.appendChild(this._muteButton);
|
|
document.body.appendChild(this._muteButton);
|
|
this._moveButtonToTopLeft();
|
|
this._moveButtonToTopLeft();
|
|
- if (!iOS) {
|
|
|
|
- this._muteButton.addEventListener('mousedown', function () {
|
|
|
|
- _this._triggerRunningState();
|
|
|
|
- }, false);
|
|
|
|
- }
|
|
|
|
|
|
+ this._muteButton.addEventListener('mousedown', function () {
|
|
|
|
+ _this._triggerRunningState();
|
|
|
|
+ }, false);
|
|
|
|
+ this._muteButton.addEventListener('touchend', function () {
|
|
|
|
+ _this._triggerRunningState();
|
|
|
|
+ }, false);
|
|
this._muteButtonDisplayed = true;
|
|
this._muteButtonDisplayed = true;
|
|
window.addEventListener("resize", this._onResize);
|
|
window.addEventListener("resize", this._onResize);
|
|
};
|
|
};
|
|
@@ -67805,6 +67777,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
document.body.appendChild(this._htmlAudioElement);
|
|
document.body.appendChild(this._htmlAudioElement);
|
|
|
|
+ this._htmlAudioElement.load();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|