Skip to content

Commit 90a56c9

Browse files
committed
do not attempt to play audio on safari
1 parent a079add commit 90a56c9

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

frontend/js/index.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ var defaultKeys = [
1515
];
1616
localStorage.setItem('retroArch',true);
1717
var gamePadType;
18+
var isSafari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1 &&
19+
navigator.userAgent &&
20+
navigator.userAgent.indexOf('CriOS') == -1 &&
21+
navigator.userAgent.indexOf('FxiOS') == -1;
1822

1923
//// Helper functions ////
2024
// Debounce calls to functions that run heavy
@@ -361,8 +365,10 @@ async function rendermenu(datas) {
361365
highlight(active_item);
362366
// Move items up
363367
function moveUp(num) {
364-
$('#bgvid').prop('muted', false);
365-
$('#bgvid').prop('volume', 0.5);
368+
if (! isSafari) {
369+
$('#bgvid').prop('muted', false);
370+
$('#bgvid').prop('volume', 0.5);
371+
}
366372
if (typeof num == 'number') {
367373
active_item = (active_item - num);
368374
} else {
@@ -382,8 +388,10 @@ async function rendermenu(datas) {
382388
};
383389
// Move items down
384390
function moveDown(num) {
385-
$('#bgvid').prop('muted', false);
386-
$('#bgvid').prop('volume', 0.5);
391+
if (! isSafari) {
392+
$('#bgvid').prop('muted', false);
393+
$('#bgvid').prop('volume', 0.5);
394+
}
387395
if (typeof num == 'number') {
388396
active_item = (active_item + num);
389397
} else {

0 commit comments

Comments
 (0)