diff --git a/jam-ui/src/components/common/ErrorBoundary.js b/jam-ui/src/components/common/ErrorBoundary.js index b9d1ef36a..b95d62ba6 100644 --- a/jam-ui/src/components/common/ErrorBoundary.js +++ b/jam-ui/src/components/common/ErrorBoundary.js @@ -33,7 +33,7 @@ class ErrorBoundary extends React.Component {
{this.state.error && this.state.error.toString()}
- {this.state.errorInfo.componentStack}
+ {this.state.errorInfo && this.state.errorInfo.componentStack}
)}
diff --git a/jam-ui/src/store/features/mediaSlice.js b/jam-ui/src/store/features/mediaSlice.js
index 87b3acaab..cb21e91cf 100644
--- a/jam-ui/src/store/features/mediaSlice.js
+++ b/jam-ui/src/store/features/mediaSlice.js
@@ -88,11 +88,11 @@ export const downloadJamTrack = createAsyncThunk(
}
// pickMyPackage logic with fallback strategy
- // Preference order:
- // 1. ogg + jkz encryption + matching sample rate (ideal)
- // 2. ogg + any encryption + matching sample rate
- // 3. any format + matching sample rate
- // 4. any package (last resort)
+ // CRITICAL: Sample rate MUST match - native client cannot play mismatched rates
+ // Preference order for matching sample rate:
+ // 1. ogg + jkz encryption (ideal for security)
+ // 2. ogg + any/no encryption (preferred format)
+ // 3. any format (mp3, etc.)
let compatiblePackage = null;
@@ -118,14 +118,10 @@ export const downloadJamTrack = createAsyncThunk(
);
}
- // Try 4: Just use first available package
+ // No fallback to different sample rates - client cannot play mismatched rates
if (!compatiblePackage) {
- compatiblePackage = mixdown.packages[0];
- console.warn(`[JamTrack] No package matches sample rate ${sampleRate}kHz, using first available package (${compatiblePackage.file_type}, ${compatiblePackage.sample_rate}kHz)`);
- }
-
- if (!compatiblePackage) {
- throw new Error(`No packages available for mixdown "${mixdown.name}"`);
+ const availableRates = mixdown.packages.map(p => p.sample_rate).join(', ');
+ throw new Error(`No package available for sample rate ${sampleRate}kHz. Available rates: ${availableRates}kHz. Try restarting your audio interface or selecting a different sample rate.`);
}
const packageId = compatiblePackage.id;