for iOS devices fallback directly to m3u8

This commit is contained in:
ArabCoders 2025-02-28 01:06:58 +03:00
parent 1fa4c523bb
commit e847fea2dd

View file

@ -52,6 +52,7 @@ const thumbnail = ref('')
const artist = ref('') const artist = ref('')
const title = ref('') const title = ref('')
const isAudio = ref(false) const isAudio = ref(false)
const isApple = /(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent)
let player = null; let player = null;
let hls = null; let hls = null;
@ -70,8 +71,8 @@ onMounted(async () => {
} }
sources.value.push({ sources.value.push({
src: makeDownload(config, props.item, 'api/download'), src: makeDownload(config, props.item, isApple ? 'm3u8' : 'api/download'),
type: response.mimetype, type: isApple ? response.mimetype : 'application/x-mpegURL',
onerror: e => src_error(e), onerror: e => src_error(e),
}) })
@ -100,7 +101,7 @@ onMounted(async () => {
}) })
}) })
if (/(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent)) { if (isApple) {
document.documentElement.style.setProperty('--webkit-text-track-display', 'block'); document.documentElement.style.setProperty('--webkit-text-track-display', 'block');
} }