mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 05:06:16 -08:00
feat(remote-control): add channel selection by number and volume control features
- Implemented `getChannelItemByNumber` utility function to retrieve channels by their number. - Enhanced `StalkerLiveStreamLayoutComponent` and `LiveStreamLayoutComponent` to handle remote control commands for channel selection and volume adjustments. - Updated typings to include new remote control commands and status updates. - Refactored `RemoteControlComponent` to manage numeric input for channel selection and volume control actions. - Improved UI for remote control with new volume and channel navigation features. - Added service methods for volume up, down, and mute toggle in `RemoteControlService`.
This commit is contained in:
1 parent
620ecb7518
commit
7c9db4bc7d
14 files changed
+1100
-400
No files matched your search
@@ -32,3 +32,26 @@ export function getAdjacentChannelItem<T>(
|
||||
|
||||
return items[nextIndex] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Nth item in a list (1-based index), or null if out of range.
|
||||
*/
|
||||
export function getChannelItemByNumber<T>(
|
||||
items: T[],
|
||||
channelNumber: number
|
||||
): T | null {
|
||||
if (
|
||||
!Array.isArray(items) ||
|
||||
items.length === 0 ||
|
||||
!Number.isFinite(channelNumber)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const index = Math.floor(channelNumber) - 1;
|
||||
if (index < 0 || index >= items.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return items[index] ?? null;
|
||||
}
|
||||
Reference in new issue
Block a user