fix: add AlertCallback alias and proper error in profile guard
Two fixes for built-in audio profile issues:
1. Add JK.AlertCallback as alias for JK.HandleAlertCallback
- Native client calls default "JK.AlertCallback" before
SessionSetAlertCallback is registered
- Now both callback names point to same handler
- Added logging for alert code 40 (audio profile issues)
2. Provide proper error when guardAgainstSinglePlayerProfile fails
- Was calling reject() with no parameter (error = undefined)
- Now creates Error object with message and canPlayResult data
- Fixes "User profile is not appropriate for session: undefined"
These issues manifest with MacBook built-in mic/speakers when the
profile check fails canPlayWithOthers(), causing tracks to not
display because session guards don't pass.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
970bbe3eb4
commit
cff2c04732
|
|
@ -298,17 +298,26 @@ const JKSessionScreen = () => {
|
|||
if (!window.JK) window.JK = {};
|
||||
|
||||
// Alert callback handler - routes backend alerts to appropriate handlers
|
||||
window.JK.HandleAlertCallback = (type, text) => {
|
||||
const alertCallbackHandler = (type, text) => {
|
||||
console.log('[AlertCallback] type:', type, 'text:', text);
|
||||
// BACKEND_MIXER_CHANGE = 2
|
||||
if (type === 2) {
|
||||
console.log('[HandleAlertCallback] BACKEND_MIXER_CHANGE:', text);
|
||||
console.log('[AlertCallback] BACKEND_MIXER_CHANGE:', text);
|
||||
if (sessionModel && sessionModel.onBackendMixerChanged) {
|
||||
sessionModel.onBackendMixerChanged(type, text);
|
||||
}
|
||||
}
|
||||
// Alert code 40: Audio profile issues (common with built-in audio)
|
||||
if (type === 40) {
|
||||
console.warn('[AlertCallback] Audio profile alert (40):', text);
|
||||
}
|
||||
// Handle other alert types as needed
|
||||
};
|
||||
|
||||
// Register under both names (native client may use either)
|
||||
window.JK.HandleAlertCallback = alertCallbackHandler;
|
||||
window.JK.AlertCallback = alertCallbackHandler;
|
||||
|
||||
return () => {
|
||||
if (window.JK) {
|
||||
delete window.JK.HandleAlertCallback;
|
||||
|
|
|
|||
|
|
@ -486,7 +486,9 @@ const useGearUtils = () => {
|
|||
const canPlayResult = await canPlayWithOthers();
|
||||
|
||||
if (!canPlayResult.canPlay) {
|
||||
reject();
|
||||
const error = new Error('Cannot play with others - profile check failed');
|
||||
error.canPlayResult = canPlayResult;
|
||||
reject(error);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue