mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
ScreenRecorder Returns
This commit is contained in:
parent
50f5fae3a4
commit
b6e6a429ec
3 changed files with 73 additions and 4 deletions
|
@ -10,7 +10,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
|
|||
|
||||
### Extra included plugins
|
||||
<details>
|
||||
<summary>146 additional plugins</summary>
|
||||
<summary>147 additional plugins</summary>
|
||||
|
||||
### All Platforms
|
||||
- AllCallTimers by MaxHerbold & D3SOX
|
||||
|
@ -158,7 +158,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
|
|||
- None At This Time
|
||||
|
||||
### Vesktop & Equibop Only
|
||||
- None At This Time
|
||||
- ScreenRecorder by AutumnVN
|
||||
|
||||
### Discord Desktop Only
|
||||
- MediaDownloader by Colorman
|
||||
|
|
|
@ -197,8 +197,8 @@ function ExcludedPluginsList({ search }: { search: string; }) {
|
|||
const ExcludedReasons: Record<"web" | "discordDesktop" | "vencordDesktop" | "equicordDesktop" | "desktop" | "dev", string> = {
|
||||
desktop: "Discord Desktop app or Vesktop",
|
||||
discordDesktop: "Discord Desktop app",
|
||||
vencordDesktop: "Vesktop app",
|
||||
equicordDesktop: "Equibop app",
|
||||
vencordDesktop: "Vesktop app & Equibop app",
|
||||
equicordDesktop: "Vesktop app & Equibop app",
|
||||
web: "Vesktop & Equibop apps as well as the Web version of Discord",
|
||||
dev: "Developer version of Equicord"
|
||||
};
|
||||
|
|
69
src/equicordplugins/screenRecorder.vencordDesktop/index.tsx
Normal file
69
src/equicordplugins/screenRecorder.vencordDesktop/index.tsx
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2023 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { addContextMenuPatch, removeContextMenuPatch } from "@api/ContextMenu";
|
||||
import { ScreenshareIcon } from "@components/Icons";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { Menu, UploadHandler } from "@webpack/common";
|
||||
|
||||
const OptionClasses = findByPropsLazy("optionName", "optionIcon", "optionLabel");
|
||||
|
||||
let recoder: MediaRecorder;
|
||||
|
||||
export default definePlugin({
|
||||
name: "ScreenRecorder",
|
||||
description: "epic screen recorder lol",
|
||||
authors: [Devs.AutumnVN],
|
||||
contextMenus: {
|
||||
"channel-attach": startRecording
|
||||
}
|
||||
});
|
||||
|
||||
function startRecording(children) {
|
||||
children.push(
|
||||
<Menu.MenuItem
|
||||
id="start-recording"
|
||||
label={
|
||||
<div className={OptionClasses.optionLabel}>
|
||||
<ScreenshareIcon className={OptionClasses.optionIcon} height={24} width={24} />
|
||||
<div className={OptionClasses.optionName}>Start Recording</div>
|
||||
</div>
|
||||
}
|
||||
action={async () => {
|
||||
const stream = await navigator.mediaDevices.getDisplayMedia({ audio: true, video: { frameRate: { ideal: 60 } } });
|
||||
recoder = new MediaRecorder(stream);
|
||||
recoder.start();
|
||||
removeContextMenuPatch("channel-attach", startRecording);
|
||||
addContextMenuPatch("channel-attach", stopRecording);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function stopRecording(children, props) {
|
||||
children.push(
|
||||
<Menu.MenuItem
|
||||
id="stop-recording"
|
||||
label={
|
||||
<div className={OptionClasses.optionLabel}>
|
||||
<ScreenshareIcon className={OptionClasses.optionIcon} height={24} width={24} />
|
||||
<div className={OptionClasses.optionName}>Stop Recording</div>
|
||||
</div>
|
||||
}
|
||||
action={() => {
|
||||
recoder.addEventListener("dataavailable", e => {
|
||||
const file = new File([e.data], "watch if cute.webm", { type: "video/webm" });
|
||||
UploadHandler.promptToUpload([file], props.channel, 0);
|
||||
});
|
||||
recoder.stop();
|
||||
removeContextMenuPatch("channel-attach", stopRecording);
|
||||
addContextMenuPatch("channel-attach", startRecording);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue