Put blop sound into separate function and only play if on desktop
This commit is contained in:
		
							parent
							
								
									c37412cfd3
								
							
						
					
					
						commit
						1d81b744ea
					
				| 
						 | 
					@ -744,7 +744,7 @@
 | 
				
			||||||
    <script src="scripts/ui-main.js" defer></script>
 | 
					    <script src="scripts/ui-main.js" defer></script>
 | 
				
			||||||
    <script src="scripts/main.js" defer></script>
 | 
					    <script src="scripts/main.js" defer></script>
 | 
				
			||||||
    <!-- Sounds -->
 | 
					    <!-- Sounds -->
 | 
				
			||||||
    <audio id="blop" autobuffer="true">
 | 
					    <audio id="blop" preload="metadata" disableremoteplayback="true" x-webkit-airplay="deny" muted>
 | 
				
			||||||
        <source src="sounds/blop.mp3" type="audio/mpeg">
 | 
					        <source src="sounds/blop.mp3" type="audio/mpeg">
 | 
				
			||||||
        <source src="sounds/blop.ogg" type="audio/ogg">
 | 
					        <source src="sounds/blop.ogg" type="audio/ogg">
 | 
				
			||||||
    </audio>
 | 
					    </audio>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -991,7 +991,7 @@ class ReceiveFileDialog extends ReceiveDialog {
 | 
				
			||||||
            badgeClassName: badgeClassName
 | 
					            badgeClassName: badgeClassName
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        window.blop.play();
 | 
					        audioPlayer.playBlop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await this._nextFiles();
 | 
					        await this._nextFiles();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -2068,7 +2068,7 @@ class ReceiveTextDialog extends Dialog {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _onText(text, peerId) {
 | 
					    _onText(text, peerId) {
 | 
				
			||||||
        window.blop.play();
 | 
					        audioPlayer.playBlop();
 | 
				
			||||||
        this._receiveTextQueue.push({text: text, peerId: peerId});
 | 
					        this._receiveTextQueue.push({text: text, peerId: peerId});
 | 
				
			||||||
        this._setDocumentTitleMessages();
 | 
					        this._setDocumentTitleMessages();
 | 
				
			||||||
        if (this.isShown()) return;
 | 
					        if (this.isShown()) return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,6 +62,24 @@ window.isMobile = window.iOS || window.android;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Helper functions
 | 
					// Helper functions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const audioPlayer = (() => {
 | 
				
			||||||
 | 
					    const blop = document.getElementById('blop');
 | 
				
			||||||
 | 
					    blop.addEventListener('ended', _ => {
 | 
				
			||||||
 | 
					        blop.muted = true
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					        playBlop() {
 | 
				
			||||||
 | 
					            if (window.isMobile) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            blop.muted = false;
 | 
				
			||||||
 | 
					            blop.play();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					})();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const zipper = (() => {
 | 
					const zipper = (() => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let zipWriter;
 | 
					    let zipWriter;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue