Simplify play target sorting

This commit is contained in:
Bill Thornton 2024-11-21 16:39:36 -05:00
parent bc7ec0e876
commit ca7311cb08
2 changed files with 10 additions and 16 deletions

View File

@ -65,17 +65,20 @@ const RemotePlayMenu: FC<RemotePlayMenuProps> = ({
open={open}
onClose={onMenuClose}
>
{!isChromecastPluginLoaded && ([
<MenuItem key='cast-unsupported-item' disabled>
{!isChromecastPluginLoaded && (
<MenuItem disabled>
<ListItemIcon>
<Warning />
</ListItemIcon>
<ListItemText>
{globalize.translate('GoogleCastUnsupported')}
</ListItemText>
</MenuItem>,
<Divider key='cast-unsupported-divider' />
])}
</MenuItem>
)}
{!isChromecastPluginLoaded && playbackTargets.length > 0 && (
<Divider />
)}
{playbackTargets.map(target => (
<MenuItem

View File

@ -852,17 +852,8 @@ export class PlaybackManager {
self.getTargets = function () {
const promises = players.filter(displayPlayerIndividually).map(getPlayerTargets);
return Promise.all(promises).then(function (responses) {
const targets = [];
for (const subTargets of responses) {
for (const subTarget of subTargets) {
targets.push(subTarget);
}
}
return targets.sort(sortPlayerTargets);
});
return Promise.all(promises)
.then(responses => responses.flat().sort(sortPlayerTargets));
};
self.playerHasSecondarySubtitleSupport = function (player = self._currentPlayer) {