fix: clear persistent Laya warning and apply language selection immediately (#12)
Two fixes: the ChannelList local-AI warning kept showing after the runtime became available because status changes were not re-evaluated on refresh; and selecting a language in the player did not switch the stream variant immediately. Refresh warning visibility from the latest laya status and apply the chosen variant/language on selection, with tests for both behaviors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -75,3 +75,22 @@ test('Laya language results participate in variant selection', () => {
|
||||
assert.equal(logical.preferredVariant.id, '1');
|
||||
assert.deepEqual(logical.availableLanguages.map(item => item.code), ['fr', 'en']);
|
||||
});
|
||||
|
||||
test('language selection immediately resolves the best visible matching variant', () => {
|
||||
const frenchSd = channel('fr-sd', 'Sports One SD');
|
||||
const frenchHd = channel('fr-hd', 'Sports One HD');
|
||||
const english4k = channel('en-4k', 'Sports One 4K');
|
||||
const languageResults = new Map([
|
||||
[grouping.getVariantKey(frenchSd), { language: 'fr', confidence: 0.9 }],
|
||||
[grouping.getVariantKey(frenchHd), { language: 'fr', confidence: 0.9 }],
|
||||
[grouping.getVariantKey(english4k), { language: 'en', confidence: 0.95 }]
|
||||
]);
|
||||
const logical = grouping.groupChannels([frenchSd, frenchHd, english4k], {
|
||||
languageMode: 'laya',
|
||||
languageResults
|
||||
})[0];
|
||||
const selected = grouping.selectVariantByLanguage(logical, 'fr', {
|
||||
isHidden: variant => variant.id === 'fr-hd'
|
||||
});
|
||||
assert.equal(selected.id, 'fr-sd');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user