mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 18:06:22 +00:00
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:
parent
64d519b54d
commit
19896ef59e
4 changed files with 12 additions and 12 deletions
|
@ -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)
|
![New icon with menu to change the playback speed](https://github.com/Vendicated/Vencord/assets/24937357/21792b09-8d6a-45be-a6e8-916cdd67a477)
|
|
@ -15,20 +15,20 @@ import { RefObject } from "react";
|
||||||
|
|
||||||
import SpeedIcon from "./components/SpeedIcon";
|
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);
|
const speeds = makeRange(0.25, 3.5, 0.25);
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "AudioPlaybackSpeed",
|
name: "MediaPlaybackSpeed",
|
||||||
description: "Adds an icon to change the playback speed of voice message and audio embeds",
|
description: "Adds an icon to change the playback speed of media embeds",
|
||||||
authors: [Devs.D3SOX],
|
authors: [Devs.D3SOX],
|
||||||
|
|
||||||
playbackSpeedComponent(audioRef: RefObject<HTMLAudioElement>) {
|
playbackSpeedComponent(mediaRef: RefObject<HTMLMediaElement>) {
|
||||||
const changeSpeed = (speed: number) => {
|
const changeSpeed = (speed: number) => {
|
||||||
const audio = audioRef.current;
|
const media = mediaRef.current;
|
||||||
if (audio) {
|
if (media) {
|
||||||
audio.playbackRate = speed;
|
media.playbackRate = speed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ export default definePlugin({
|
||||||
replace: "$&,$self.playbackSpeedComponent($1)"
|
replace: "$&,$self.playbackSpeedComponent($1)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// audio embeds
|
// audio & video embeds
|
||||||
{
|
{
|
||||||
// need to pass media ref via props to make it easily accessible from inside controls
|
// need to pass media ref via props to make it easily accessible from inside controls
|
||||||
find: "renderControls(){",
|
find: "renderControls(){",
|
|
@ -1,10 +1,10 @@
|
||||||
.vc-audio-playback-speed-icon {
|
.vc-media-playback-speed-icon {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
color: var(--interactive-normal);
|
color: var(--interactive-normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
.vc-audio-playback-speed-icon:hover {
|
.vc-media-playback-speed-icon:hover {
|
||||||
color: var(--interactive-active);
|
color: var(--interactive-active);
|
||||||
}
|
}
|
Loading…
Reference in a new issue