Fix YouTube track live attribute (#574)

This commit is contained in:
Max Isom 2022-03-15 18:58:39 -04:00 committed by GitHub
parent 667894e829
commit df803b8c76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- The duration of live YouTube streams is now correctly formatted again
## [1.6.0] - 2022-03-13
### Changed

View file

@ -193,7 +193,7 @@ export default class {
offset: 0,
url,
playlist: queuedPlaylist ?? null,
isLive: false,
isLive: (video as YoutubeVideo).snippet.liveBroadcastContent === 'live',
thumbnailUrl: video.snippet.thumbnails.medium.url,
};

View file

@ -45,7 +45,7 @@ const getPlayerUI = (player: Player) => {
const position = player.getPosition();
const button = player.status === STATUS.PLAYING ? '⏹️' : '▶️';
const progressBar = getProgressBar(15, position / song.length);
const elapsedTime = `${prettyTime(position)}/${song.isLive ? 'live' : prettyTime(song.length)}`;
const elapsedTime = song.isLive ? 'live' : `${prettyTime(position)}/${prettyTime(song.length)}`;
return `${button} ${progressBar} \`[${elapsedTime}]\` 🔉`;
};