|
@@ -186,10 +186,6 @@
|
|
|
catch (e) {
|
|
|
// protect error during capability check.
|
|
|
}
|
|
|
-
|
|
|
- if (/iPad|iPhone|iPod/.test(navigator.platform)) {
|
|
|
- this._unlockiOSaudio();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -208,34 +204,6 @@
|
|
|
this._triggerRunningState();
|
|
|
}
|
|
|
|
|
|
- private _unlockiOSaudio() {
|
|
|
- this._displayMuteButton(true);
|
|
|
-
|
|
|
- var unlockaudio = () => {
|
|
|
- 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(() => {
|
|
|
- if (((<any>source).playbackState === (<any>source).PLAYING_STATE || (<any>source).playbackState === (<any>source).FINISHED_STATE)) {
|
|
|
- this._triggerRunningState();
|
|
|
- if (this._muteButton) {
|
|
|
- this._muteButton.removeEventListener('touchend', unlockaudio, false);
|
|
|
- }
|
|
|
- }
|
|
|
- }, 0);
|
|
|
- };
|
|
|
-
|
|
|
- if (this._muteButton) {
|
|
|
- this._muteButton.addEventListener('touchend', unlockaudio, false);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private _resumeAudioContext() {
|
|
|
if (this._audioContext!.resume) {
|
|
|
this._audioContext!.resume();
|
|
@@ -293,7 +261,7 @@
|
|
|
this._displayMuteButton();
|
|
|
}
|
|
|
|
|
|
- private _displayMuteButton(iOS: boolean = false) {
|
|
|
+ private _displayMuteButton() {
|
|
|
if (this.useCustomUnlockedButton) {
|
|
|
return;
|
|
|
}
|
|
@@ -314,11 +282,13 @@
|
|
|
|
|
|
this._moveButtonToTopLeft();
|
|
|
|
|
|
- if (!iOS) {
|
|
|
- this._muteButton.addEventListener('mousedown', () => {
|
|
|
- this._triggerRunningState();
|
|
|
- }, false);
|
|
|
- }
|
|
|
+ this._muteButton.addEventListener('mousedown', () => {
|
|
|
+ this._triggerRunningState();
|
|
|
+ }, false);
|
|
|
+ this._muteButton.addEventListener('touchend', () => {
|
|
|
+ this._triggerRunningState();
|
|
|
+ }, false);
|
|
|
+
|
|
|
this._muteButtonDisplayed = true;
|
|
|
|
|
|
window.addEventListener("resize", this._onResize);
|