fix(streaming): fix Hi-res playback on Firefox
This commit is contained in:
parent
15c3702cae
commit
6d9d2f4f89
2 changed files with 12 additions and 18 deletions
|
|
@ -1,11 +1,5 @@
|
|||
//js/api.js
|
||||
import {
|
||||
RATE_LIMIT_ERROR_MESSAGE,
|
||||
deriveTrackQuality,
|
||||
delay,
|
||||
isTrackUnavailable,
|
||||
getExtensionFromBlob,
|
||||
} from './utils.js';
|
||||
import { RATE_LIMIT_ERROR_MESSAGE, deriveTrackQuality, delay, isTrackUnavailable, getExtensionFromBlob } from './utils.js';
|
||||
import { APICache } from './cache.js';
|
||||
import { addMetadataToAudio } from './metadata.js';
|
||||
import { DashDownloader } from './dash-downloader.js';
|
||||
|
|
|
|||
22
js/utils.js
22
js/utils.js
|
|
@ -80,16 +80,6 @@ export const sanitizeForFilename = (value) => {
|
|||
.trim();
|
||||
};
|
||||
|
||||
export const getExtensionForQuality = (quality) => {
|
||||
switch (quality) {
|
||||
case 'LOW':
|
||||
case 'HIGH':
|
||||
return 'm4a';
|
||||
default:
|
||||
return 'flac';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Detects actual audio format from blob signature
|
||||
* @param {Blob} blob - Audio blob to analyze
|
||||
|
|
@ -130,6 +120,16 @@ export const getExtensionFromBlob = async (blob) => {
|
|||
return 'flac';
|
||||
};
|
||||
|
||||
export const getExtensionForQuality = (quality) => {
|
||||
switch (quality) {
|
||||
case 'LOW':
|
||||
case 'HIGH':
|
||||
return 'm4a';
|
||||
default:
|
||||
return 'flac';
|
||||
}
|
||||
};
|
||||
|
||||
export const buildTrackFilename = (track, quality, extension = null) => {
|
||||
const template = localStorage.getItem('filename-template') || '{trackNumber} - {artist} - {title}';
|
||||
const ext = extension || getExtensionForQuality(quality);
|
||||
|
|
@ -143,7 +143,7 @@ export const buildTrackFilename = (track, quality, extension = null) => {
|
|||
album: track.album?.title,
|
||||
};
|
||||
|
||||
return formatTemplate(template, data) + '.' + ext;
|
||||
return formatTemplate(template, data) + '.' + extension;
|
||||
};
|
||||
|
||||
const sanitizeToken = (value) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue