fix: issues with default player

This commit is contained in:
Rogee
2024-12-28 15:17:19 +08:00
parent 464937cf84
commit dae2941168
4 changed files with 41 additions and 8 deletions

View File

@@ -142,10 +142,19 @@ const play = (hash, type) => {
player.play();
});
} else if (player.canPlayType("application/vnd.apple.mpegurl")) {
player.src = source;
player.addEventListener("loadedmetadata", function () {
player.play();
});
var xhr = new XMLHttpRequest();
xhr.open('GET', source, true);
xhr.setRequestHeader("Authorization", "Bearer " + __GA);
xhr.responseType = 'blob';
xhr.onload = function () {
if (xhr.status === 200) {
player.src = URL.createObjectURL(xhr.response);
player.addEventListener("loadedmetadata", function () {
player.play();
});
}
};
xhr.send();
}
};
</script>