Skip to content

Commit

Permalink
Merge branch 'dev' into dependabot/npm_and_yarn/dev/react-icons-5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
VampireChicken12 authored Jan 10, 2025
2 parents ac1b50e + e3518ea commit a18d7f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions src/features/playbackSpeedButtons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getFeatureIcon } from "@/src/icons";
import { type YouTubePlayerDiv, youtubePlayerMinSpeed } from "@/src/types";
import eventManager from "@/src/utils/EventManager";
import OnScreenDisplayManager from "@/src/utils/OnScreenDisplayManager";
import { createTooltip, isWatchPage, round, waitForSpecificMessage } from "@/src/utils/utilities";
import { createTooltip, isWatchPage, isLivePage, round, waitForSpecificMessage } from "@/src/utils/utilities";

import type { AddButtonFunction, RemoveButtonFunction } from "../index";
let currentPlaybackSpeed = 1;
Expand Down Expand Up @@ -131,11 +131,10 @@ export const addIncreasePlaybackSpeedButton: AddButtonFunction = async () => {
}
} = await waitForSpecificMessage("options", "request_data", "content");
if (!enable_playback_speed_buttons) return;
if (!isWatchPage()) return;
const videoElement = document.querySelector<HTMLVideoElement>("video");
if (!videoElement) return;
({ playbackRate: currentPlaybackSpeed } = videoElement);
const playerContainer = document.querySelector<YouTubePlayerDiv>("div#movie_player");
const playerContainer = isWatchPage() || isLivePage() ? document.querySelector<YouTubePlayerDiv>("div#movie_player") : null;
if (!playerContainer) return;
const playerVideoData = await playerContainer.getVideoData();
if (playerVideoData.isLive && checkIfFeatureButtonExists("increasePlaybackSpeedButton", increasePlaybackSpeedButtonPlacement)) {
Expand Down Expand Up @@ -171,12 +170,11 @@ export const addDecreasePlaybackSpeedButton: AddButtonFunction = async () => {
}
} = await waitForSpecificMessage("options", "request_data", "content");
if (!enable_playback_speed_buttons) return;
if (!isWatchPage()) return;
const videoElement = document.querySelector<HTMLVideoElement>("video");
if (!videoElement) return;
const minSpeed = getMinSpeed(playbackSpeedPerClick);
({ playbackRate: currentPlaybackSpeed } = videoElement);
const playerContainer = document.querySelector<YouTubePlayerDiv>("div#movie_player");
const playerContainer = isWatchPage() || isLivePage() ? document.querySelector<YouTubePlayerDiv>("div#movie_player") : null;
if (!playerContainer) return;
const playerVideoData = await playerContainer.getVideoData();
if (playerVideoData.isLive && checkIfFeatureButtonExists("decreasePlaybackSpeedButton", decreasePlaybackSpeedButtonPlacement)) {
Expand Down

0 comments on commit a18d7f7

Please sign in to comment.