From c1602e7087445f1526a6127cb795ea2fafeeb91b Mon Sep 17 00:00:00 2001 From: Korbs Date: Fri, 29 Nov 2024 17:45:45 -0500 Subject: [PATCH] Add YouTube support --- package.json | 4 ++-- src/Player.astro | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c09bac5..703440a 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "live-streaming" ], "type": "module", - "version": "0.4.63", + "version": "0.4.65", "exports": { ".": "./index.ts" }, @@ -30,7 +30,7 @@ "astro": "^4.14.2" }, "scripts": { - "npm:publish": "npm publish --registry https://npm.sudovanilla.org/", + "publish": "npm publish && npm publish --registry https://npm.sudovanilla.org/", "test": "cd test/ && bun start" } } \ No newline at end of file diff --git a/src/Player.astro b/src/Player.astro index 929f839..86a1ce3 100644 --- a/src/Player.astro +++ b/src/Player.astro @@ -11,6 +11,11 @@ const { VideoAttributes, AudioAttributes, + YouTube = false, + YouTubeQuality = '137', + Invidious, + WatchId, + Milieu, MilieuMode = "Default", MilieuSpeed = "2000", @@ -29,14 +34,27 @@ import Controller from './Controls/Controller.astro' import Seek from './Controls/Seek.astro' import Sync from './Controls/Sync.astro' +// YouTube +if (YouTube === true) { + // 8K = 272 + // 4K = 315 + // 1080p = 137 + // 720p = 302 + // Dash Audio = 251 + var YTVideo = 'https://' + Invidious +'/latest_version?id=' + WatchId + '&itag=' + YouTubeQuality + var YTAudio = 'https://' + Invidious +'/latest_version?id=' + WatchId + '&itag=251' +} else if (YouTube === false) { + null +} + // Icons and Styles import './Styles/Index.scss' import './Styles/Iconoir.css' ---
- - {Audio ? : null } + + {Audio ? : null } {Audio ? : null } {Milieu ?