refactor: Enhance Stalker Live Stream Layout and EPG components

- Refactored StalkerLiveStreamLayoutComponent to improve channel selection and playback handling.
- Introduced new methods for building external playback headers and handling cross-origin streams.
- Updated EPG preview logic to use a more structured approach with EpgProgram type.
- Improved styling for channel list items, including hover effects and active states.
- Enhanced EPG view with a more responsive layout and improved item display.
- Updated video player components to ensure proper sizing and overflow handling.
- Added fallback handling for channel logos and improved action button visibility.
This commit is contained in:
4gray committed 2026-03-05 23:34:17 +01:00
1 parent e76466e250
commit 698668f3e3
12 files changed
+820 -590

No files matched your search

@@ -12,78 +12,84 @@
<mat-icon cdkDragHandle class="drag-icon">drag_indicator</mat-icon>
}
<div class="channel-content">
@if (logo()) {
<img
class="channel-logo"
[src]="logo()"
onerror="this.style.display = 'none'"
alt="Channel Logo"
/>
}
<div class="channel-logo-shell" aria-hidden="true">
@if (showLogoFallback()) {
<mat-icon class="channel-logo-fallback">live_tv</mat-icon>
}
@if (logo()) {
<img
class="channel-logo"
[src]="logo()"
(error)="onLogoError($event)"
alt="Channel Logo"
/>
}
</div>
<div class="channel-details">
<div class="channel-name">{{ name() }}</div>
@if (showEpg()) {
<div class="epg-container">
<div class="epg-content">
@if (epgProgram(); as program) {
<div class="epg-title">
{{ program.title }}
</div>
<div class="epg-timeline">
<span class="epg-time"
>{{ formatTime(program.start) }} -
{{ formatTime(program.stop) }}</span
>
<div class="epg-progress-track">
<div
class="epg-progress-fill"
[ngStyle]="{
width: progressPercentage() + '%',
}"
></div>
</div>
</div>
} @else {
<div class="epg-placeholder">
{{ 'EPG.NO_PROGRAM_INFO' | translate }}
</div>
}
@if (epgProgram(); as program) {
<div class="epg-title">
{{ program.title }}
</div>
</div>
<div class="epg-timeline">
<span class="epg-time">{{
formatTime(program.start)
}}</span>
<div class="epg-progress-track">
<div
class="epg-progress-fill"
[ngStyle]="{
width: progressPercentage() + '%',
}"
></div>
</div>
<span class="epg-time">{{
formatTime(program.stop)
}}</span>
</div>
} @else {
<div class="epg-placeholder">
{{ 'EPG.NO_PROGRAM_INFO' | translate }}
</div>
}
}
</div>
</div>
<!-- Action buttons column -->
<div class="action-buttons">
@if (showEpg() && epgProgram(); as program) {
<button
mat-icon-button
class="program-info-button"
[matTooltip]="
'EPG.PROGRAM_DIALOG.SHOW_PROGRAM_DETAILS' | translate
"
(click)="showProgramDescription(program, $event)"
>
<mat-icon>info</mat-icon>
</button>
}
@if (showFavoriteButton()) {
<button
mat-icon-button
class="favorite-button"
color="primary"
[matTooltip]="
(isFavorite()
? 'CHANNELS.REMOVE_FAVORITE'
: 'CHANNELS.ADD_FAVORITE'
) | translate
"
(click)="favoriteToggled.emit($event)"
>
<mat-icon [color]="isFavorite() ? 'accent' : ''">{{
isFavorite() ? 'star' : 'star_border'
}}</mat-icon>
</button>
}
</div>
@if (
(showProgramInfoButton() && showEpg() && epgProgram()) ||
showFavoriteButton()
) {
<div class="action-buttons">
@if (showProgramInfoButton() && showEpg() && epgProgram(); as program) {
<button
mat-icon-button
class="program-info-button"
[matTooltip]="
'EPG.PROGRAM_DIALOG.SHOW_PROGRAM_DETAILS' | translate
"
(click)="showProgramDescription(program, $event)"
>
<mat-icon>info</mat-icon>
</button>
}
@if (showFavoriteButton()) {
<button
mat-icon-button
class="favorite-button"
[matTooltip]="
(isFavorite()
? 'CHANNELS.REMOVE_FAVORITE'
: 'CHANNELS.ADD_FAVORITE'
) | translate
"
(click)="onFavoriteClick($event)"
>
<mat-icon>{{
isFavorite() ? 'star' : 'star_outline'
}}</mat-icon>
</button>
}
</div>
}
</div>
@@ -1,295 +1,301 @@
// Main channel list item container
:host {
display: block;
width: 100%;
container-type: inline-size;
}
.channel-list-item {
width: 100%;
min-height: 68px;
display: flex;
align-items: center;
height: 68px;
padding: 8px 12px;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.2s ease;
gap: 12px;
padding: 8px 10px 8px 12px;
border: 1px solid transparent;
border-radius: 12px;
background: transparent;
color: inherit;
cursor: pointer;
box-sizing: border-box;
min-width: 0;
overflow: hidden;
transition:
background 0.15s ease,
border-color 0.15s ease,
box-shadow 0.18s ease,
transform 0.18s ease,
color 0.15s ease;
&:hover {
background-color: rgba(0, 0, 0, 0.04);
background: color-mix(in srgb, currentColor 8%, transparent);
}
&.active {
background-color: rgba(0, 0, 0, 0.08);
background: linear-gradient(
135deg,
var(--app-selection-surface-strong),
var(--app-selection-surface)
);
border-color: var(--app-selection-border);
color: var(--app-selection-color);
box-shadow:
inset 0 0 0 1px var(--app-selection-border),
0 12px 20px -18px var(--app-selection-glow);
transform: translateY(-1px);
}
// Compact mode when EPG is not shown
&.compact {
height: 48px;
padding: 6px 12px;
min-height: 52px;
padding-block: 7px;
}
}
// Dark theme support
::ng-deep .dark-theme {
.channel-list-item {
&:hover {
background-color: rgba(255, 255, 255, 0.04);
}
&.active {
background-color: rgba(255, 255, 255, 0.08);
}
}
}
// Drag handle icon
.drag-icon {
flex-shrink: 0;
cursor: move;
margin-right: 4px;
opacity: 0.5;
opacity: 0.46;
}
// Main content area
.channel-content {
min-width: 0;
flex: 1;
display: flex;
align-items: center;
flex: 1;
gap: 12px;
min-width: 0; // Allow text truncation
}
// Channel logo
.channel-logo {
width: 42px;
height: 42px;
border-radius: 4px;
object-fit: contain;
.channel-logo-shell {
position: relative;
width: 44px;
height: 44px;
flex-shrink: 0;
border-radius: 10px;
display: grid;
place-items: center;
overflow: hidden;
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0)),
rgba(127, 127, 127, 0.12);
box-shadow:
inset 0 0 0 1px rgba(255, 255, 255, 0.08),
inset 0 1px 1px rgba(0, 0, 0, 0.15);
// Smaller logo in compact mode
.compact & {
width: 32px;
height: 32px;
width: 38px;
height: 38px;
}
}
// Channel details (name + EPG)
.channel-details {
display: flex;
flex-direction: column;
gap: 2px;
flex: 1;
min-width: 0; // Allow text truncation
overflow: visible;
}
// Channel name
.channel-name {
font-family: 'DM Sans', sans-serif;
font-weight: 500;
font-size: 0.9rem;
line-height: 1.3;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
max-width: 100%;
}
// EPG container - holds EPG content and info button
.epg-container {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
overflow: visible;
}
// EPG content area
.epg-content {
display: flex;
flex-direction: column;
gap: 2px;
flex: 1;
min-width: 0;
overflow: hidden; // Allow text truncation within content
}
// EPG title (program name)
.epg-title {
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
Arial, sans-serif;
font-size: 0.8rem;
font-weight: 500;
opacity: 0.85;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 1.2;
min-width: 0;
max-width: 100%;
}
// EPG timeline container
.epg-timeline {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
max-width: 100%;
}
// EPG time display
.epg-time {
font-family: 'DM Sans', sans-serif;
font-size: 0.7rem;
opacity: 0.6;
letter-spacing: 0.02em;
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
max-width: 100%;
}
// EPG placeholder (when no data available)
.epg-placeholder {
font-family: 'DM Sans', sans-serif;
font-size: 0.75rem;
.channel-logo-fallback {
position: absolute;
inset: 0;
margin: auto;
width: 18px;
height: 18px;
font-size: 18px;
opacity: 0.5;
font-style: italic;
}
.channel-logo {
position: relative;
z-index: 1;
width: 100%;
height: 100%;
object-fit: contain;
padding: 6px;
box-sizing: border-box;
}
.channel-details {
min-width: 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
gap: 3px;
}
.channel-name {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
max-width: 100%;
font-size: 0.96rem;
font-weight: 600;
letter-spacing: 0.01em;
line-height: 1.2;
}
.epg-title {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 0.82rem;
line-height: 1.2;
opacity: 0.84;
}
.epg-timeline {
min-width: 0;
display: grid;
grid-template-columns: auto minmax(0, 1fr) auto;
align-items: center;
gap: 10px;
}
.epg-time {
font-size: 0.75rem;
line-height: 1;
opacity: 0.72;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
// Progress track
.epg-progress-track {
position: relative;
width: 100%;
height: 3px;
background: rgba(128, 128, 128, 0.2);
border-radius: 2px;
height: 6px;
overflow: hidden;
border-radius: 999px;
background-color: rgba(127, 127, 127, 0.28);
background-image: linear-gradient(
180deg,
rgba(255, 255, 255, 0.12),
rgba(255, 255, 255, 0)
);
box-shadow:
inset 0 0 0 1px rgba(255, 255, 255, 0.12),
inset 0 1px 1px rgba(0, 0, 0, 0.18);
}
// Progress fill
.epg-progress-fill {
position: absolute;
left: 0;
top: 0;
height: 100%;
background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
border-radius: 2px;
transition: width 0.5s ease-out;
box-shadow: 0 0 6px rgba(124, 58, 237, 0.4);
inset-block: 0;
inset-inline-start: 0;
border-radius: inherit;
background-color: var(--app-selection-color);
background-image: linear-gradient(
90deg,
rgba(255, 255, 255, 0.18),
rgba(255, 255, 255, 0)
);
box-shadow:
0 0 0 1px color-mix(in srgb, var(--app-selection-border) 82%, transparent),
0 0 10px -2px var(--app-selection-glow);
transition: width 0.35s ease;
}
// Favorite button
.favorite-button {
flex-shrink: 0;
.epg-placeholder {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 0.78rem;
line-height: 1.2;
opacity: 0.52;
}
// Program info button
.program-info-button {
flex-shrink: 0;
opacity: 0.7;
&:hover {
opacity: 1;
}
}
// Action buttons column (info + favorite stacked vertically)
.action-buttons {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-left: auto;
gap: 0;
display: flex;
align-items: center;
gap: 2px;
margin-inline-start: auto;
button {
width: 32px;
height: 32px;
line-height: 32px;
padding: 0;
width: 34px;
height: 34px;
border-radius: 10px;
color: inherit;
opacity: 0.76;
transition:
opacity 0.15s ease,
background-color 0.15s ease,
transform 0.15s ease;
.mat-icon {
font-size: 20px;
width: 20px;
height: 20px;
line-height: 20px;
&:hover {
opacity: 1;
background: color-mix(in srgb, currentColor 10%, transparent);
transform: translateY(-1px);
}
}
mat-icon {
width: 20px;
height: 20px;
font-size: 20px;
}
}
// ============================================================================
// Container queries for responsive sidebar resizing
// ============================================================================
.channel-list-item.active {
.epg-title,
.epg-time,
.epg-placeholder,
.drag-icon,
.action-buttons button,
.action-buttons mat-icon {
color: inherit;
}
}
@container (max-width: 350px) {
@container (max-width: 360px) {
.channel-list-item {
gap: 8px;
padding: 6px 8px;
gap: 10px;
padding-inline: 10px 8px;
}
.channel-logo {
width: 36px;
height: 36px;
.channel-logo-shell {
width: 40px;
height: 40px;
}
// Hide EPG timeline (progress bar + times) but keep program title
.epg-timeline {
display: none;
gap: 8px;
}
.epg-placeholder {
display: none;
.action-buttons {
gap: 0;
}
}
@container (max-width: 310px) {
.epg-timeline {
grid-template-columns: 1fr;
gap: 5px;
}
// Hide info button, keep only favorite
.epg-time:last-child {
display: none;
}
}
@container (max-width: 270px) {
.channel-list-item {
min-height: 52px;
gap: 8px;
padding-inline: 8px 6px;
}
.channel-logo-shell {
width: 34px;
height: 34px;
}
.epg-title,
.epg-timeline,
.epg-placeholder,
.program-info-button {
display: none;
}
}
@container (max-width: 280px) {
.channel-logo {
width: 28px;
height: 28px;
}
// Hide all EPG content
.epg-container {
display: none;
}
.channel-list-item {
height: 48px;
&.compact {
height: 40px;
}
}
// Hide action buttons
@container (max-width: 220px) {
.channel-logo-shell,
.action-buttons {
display: none;
}
}
@container (max-width: 200px) {
.channel-logo {
display: none;
}
.channel-list-item {
gap: 4px;
padding: 4px 6px;
.channel-content {
gap: 0;
}
}
@@ -3,9 +3,11 @@ import { NgStyle } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
effect,
inject,
input,
output,
signal,
} from '@angular/core';
import { MatIconButton } from '@angular/material/button';
import { MatDialog } from '@angular/material/dialog';
@@ -31,11 +33,13 @@ import { EpgItemDescriptionComponent } from '../../epg-list/epg-item-description
})
export class ChannelListItemComponent {
private readonly dialog = inject(MatDialog);
private readonly logoFailed = signal(false);
readonly isDraggable = input(false);
readonly logo = input.required<string>();
readonly logo = input<string | null | undefined>('');
readonly name = input('');
readonly showFavoriteButton = input(false);
readonly showProgramInfoButton = input(true);
readonly isFavorite = input(false);
readonly selected = input(false);
readonly showEpg = input(true);
@@ -46,6 +50,13 @@ export class ChannelListItemComponent {
readonly clicked = output<void>();
readonly favoriteToggled = output<MouseEvent>();
constructor() {
effect(() => {
this.logo();
this.logoFailed.set(false);
});
}
/**
* Formats time for display (HH:mm)
*/
@@ -69,4 +80,21 @@ export class ChannelListItemComponent {
data: program,
});
}
onFavoriteClick(event: MouseEvent): void {
event.stopPropagation();
this.favoriteToggled.emit(event);
}
showLogoFallback(): boolean {
return !this.logo() || this.logoFailed();
}
onLogoError(event: Event): void {
this.logoFailed.set(true);
(event.target as HTMLImageElement | null)?.style.setProperty(
'display',
'none'
);
}
}
@@ -1,7 +1,15 @@
:host {
display: block;
width: 100%;
height: 100%;
min-height: 0;
overflow: hidden;
}
.video-js {
position: relative !important;
width: 100% !important;
height: calc(100vh - 65px);
height: 100% !important;
}
/* Hide the captions settings item from the captions menu. */
@@ -16,9 +24,3 @@
.video-js .vjs-menu-button-popup .vjs-menu {
z-index: 10;
}
@media only screen and (max-width: 599px) {
.video-js {
height: calc(50vh - 65px) !important;
}
}