Skip to content

Commit

Permalink
- Fallback for audio player on browse to handle tracks without positi…
Browse files Browse the repository at this point in the history
…ons array set.
  • Loading branch information
hardiesoft committed Feb 19, 2025
1 parent 14ef57b commit 92d4160
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions browse/src/components/Audio/AudioPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,19 @@ export default defineComponent({
const createRectFromTrack = (track: AudioTrack) => {
const id = `track_${track.id.toString()}`;
const isTemp = track.id === -1;
const pos = isTemp
? track.positions[1]
: track.positions[track.positions.length - 1]; // Temp track uses second position
let pos;
if (track.positions) {
pos = isTemp
? track.positions[1]
: track.positions[track.positions.length - 1]; // Temp track uses second position
} else {
pos = {
x: track.start / props.duration,
y: (track.minFreq || 0) / props.sampleRate,
height: (track.maxFreq || 0 - track.minFreq || 0) / props.sampleRate,
width: (track.end - track.start) / props.duration,
};
}
let { x, y, height, width } = pos

Check warning on line 535 in browse/src/components/Audio/AudioPlayer.vue

View workflow job for this annotation

GitHub Actions / lint

'y' is never reassigned. Use 'const' instead

Check warning on line 535 in browse/src/components/Audio/AudioPlayer.vue

View workflow job for this annotation

GitHub Actions / lint

'height' is never reassigned. Use 'const' instead

Check warning on line 535 in browse/src/components/Audio/AudioPlayer.vue

View workflow job for this annotation

GitHub Actions / lint

'y' is never reassigned. Use 'const' instead

Check warning on line 535 in browse/src/components/Audio/AudioPlayer.vue

View workflow job for this annotation

GitHub Actions / lint

'height' is never reassigned. Use 'const' instead
? convertRectangleToSVG(pos)
: {
Expand Down

0 comments on commit 92d4160

Please sign in to comment.