Skip to content

Commit

Permalink
fix(YouTube): add auto-hide option (#8328)
Browse files Browse the repository at this point in the history
  • Loading branch information
ION606 authored Apr 29, 2024
1 parent c8838eb commit cfced64
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion websites/Y/YouTube/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"*://www.youtube.com/*",
"*://studio.youtube.com/*"
],
"version": "5.10.4",
"version": "5.10.5",
"logo": "https://cdn.rcd.gg/PreMiD/websites/Y/YouTube/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/Y/YouTube/assets/thumbnail.jpg",
"color": "#E40813",
Expand All @@ -95,6 +95,15 @@
"icon": "fad fa-user-secret",
"value": false
},
{
"id": "hidePaused",
"title": "Hide Paused",
"icon": "fad fa-pause-circle",
"value": false,
"if": {
"privacy": false
}
},
{
"id": "privacy-shown",
"title": "Show Privacy Button",
Expand Down
6 changes: 6 additions & 0 deletions websites/Y/YouTube/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ presence.on("UpdateData", async () => {
channelPic,
logo,
buttons,
hidePaused,
] = [
getSetting<string>("lang", "en"),
getSetting<boolean>("privacy", true),
Expand All @@ -62,6 +63,7 @@ presence.on("UpdateData", async () => {
getSetting<boolean>("channelPic", false),
getSetting<number>("logo", 0),
getSetting<boolean>("buttons", true),
getSetting<boolean>("hidePaused", true),
],
{ pathname, hostname, search, href } = document.location;

Expand All @@ -74,6 +76,10 @@ presence.on("UpdateData", async () => {
).find(video => video.duration);

if (video) {
const { mediaSession } = navigator;
if (mediaSession.playbackState !== "playing" && hidePaused)
return presence.clearActivity();

const resolver = [
youtubeEmbedResolver,
youtubeShortsResolver,
Expand Down

0 comments on commit cfced64

Please sign in to comment.