refactored audio-player component

This commit is contained in:
itzMiney committed 2026-03-17 01:45:09 +01:00
1 parent 357e1b6cf3
commit b396728db8
3 files changed
+29 -6

No files matched your search

@@ -1,4 +1,6 @@
import {Component, AfterViewInit, signal} from '@angular/core';
import {Component, AfterViewInit, signal, OnInit} from '@angular/core';
import {DeviceDetectorService} from '../services/device-detector.service';
import {NgClass} from '@angular/common';
declare global {
@@ -10,16 +12,26 @@ declare global {
@Component({
selector: 'app-audio-player',
imports: [],
imports: [
NgClass
],
templateUrl: './audio-player.component.html',
styleUrl: './audio-player.component.css'
})
export class AudioPlayerComponent implements AfterViewInit {
export class AudioPlayerComponent implements AfterViewInit, OnInit {
isMobile: boolean = false;
private player: any;
isPlayerReady = signal(false);
isPlaying = signal(false);
nowPlayingTitle = signal<string>('');
constructor(private deviceService: DeviceDetectorService) {}
ngOnInit() {
this.isMobile = this.deviceService.isMobile;
}
ngAfterViewInit() {
if (window.YT && window.YT.Player) {
this.createPlayer();