refactor(audioPlaybackSpeed): rename to MediaPlaybackSpeed

I was about to add support for videos but then I noticed it already works xD
This commit is contained in:
D3SOX 2024-06-02 14:42:43 +02:00
parent 64d519b54d
commit 19896ef59e
No known key found for this signature in database
GPG key ID: 39EC1673FC37B048
4 changed files with 12 additions and 12 deletions

View file

@ -1,5 +1,5 @@
# AudioPlaybackSpeed
# MediaPlaybackSpeed
Adds an icon to change the playback speed of voice message and audio embeds
Adds an icon to change the playback speed of media embeds
![New icon with menu to change the playback speed](https://github.com/Vendicated/Vencord/assets/24937357/21792b09-8d6a-45be-a6e8-916cdd67a477)

View file

@ -15,20 +15,20 @@ import { RefObject } from "react";
import SpeedIcon from "./components/SpeedIcon";
const cl = classNameFactory("vc-audio-playback-speed-");
const cl = classNameFactory("vc-media-playback-speed-");
const speeds = makeRange(0.25, 3.5, 0.25);
export default definePlugin({
name: "AudioPlaybackSpeed",
description: "Adds an icon to change the playback speed of voice message and audio embeds",
name: "MediaPlaybackSpeed",
description: "Adds an icon to change the playback speed of media embeds",
authors: [Devs.D3SOX],
playbackSpeedComponent(audioRef: RefObject<HTMLAudioElement>) {
playbackSpeedComponent(mediaRef: RefObject<HTMLMediaElement>) {
const changeSpeed = (speed: number) => {
const audio = audioRef.current;
if (audio) {
audio.playbackRate = speed;
const media = mediaRef.current;
if (media) {
media.playbackRate = speed;
}
};
@ -70,7 +70,7 @@ export default definePlugin({
replace: "$&,$self.playbackSpeedComponent($1)"
}
},
// audio embeds
// audio & video embeds
{
// need to pass media ref via props to make it easily accessible from inside controls
find: "renderControls(){",

View file

@ -1,10 +1,10 @@
.vc-audio-playback-speed-icon {
.vc-media-playback-speed-icon {
background-color: transparent;
height: 100%;
z-index: 2;
color: var(--interactive-normal);
}
.vc-audio-playback-speed-icon:hover {
.vc-media-playback-speed-icon:hover {
color: var(--interactive-active);
}