mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-27 20:58:01 +02:00
parent
05b40b6782
commit
aca1ce3bb7
1 changed files with 12 additions and 5 deletions
|
@ -14,6 +14,11 @@ const player = usePlayer(),
|
|||
|
||||
const audio = ref(null);
|
||||
|
||||
const dataOf = Object.freeze({
|
||||
1002: 1,
|
||||
3016: 0,
|
||||
});
|
||||
|
||||
function audioCanPlay() {
|
||||
player.state.status = 'pause';
|
||||
audio.value.play().catch(err => {
|
||||
|
@ -43,6 +48,7 @@ async function Stream() {
|
|||
codecs = store.getItem('codec');
|
||||
|
||||
await audioPlayer.attach(audio.value);
|
||||
audioPlayer.addEventListener('error', ({ detail }) => errorLog(detail));
|
||||
|
||||
for (const [playerKey, audioKey] of Object.entries({
|
||||
rate: 'playbackRate',
|
||||
|
@ -123,11 +129,12 @@ async function Stream() {
|
|||
);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
.catch(errorLog);
|
||||
}
|
||||
|
||||
function errorLog(err) {
|
||||
a.add(err.data[dataOf[err.code]] ?? 'Shaka Error: ' + err.code);
|
||||
console.error(err);
|
||||
if (err.code == 3016) a.add('MediaError: ' + err.data[0]);
|
||||
else a.add('Error: ' + err.code);
|
||||
});
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue