Skip to content

🎥 Make videos programmatically with React

Merge branch 'webcodec-tests' into rotate-webcodecs

Jonny Burgerce423f716d0e
diff --cc packages/convert/app/components/ConvertUi.tsx
index 84ab919111,223ef11e42..a2ec503377
--- a/packages/convert/app/components/ConvertUi.tsx
+++ b/packages/convert/app/components/ConvertUi.tsx
@@@ -1,5 -1,7 +1,6 @@@
import {Button} from '@/components/ui/button';
-import {CardTitle} from '@/components/ui/card';
import {
+ LogLevel,
MediaParserAudioCodec,
MediaParserInternals,
MediaParserVideoCodec,
@@@ -48,25 -50,10 +51,25 @@@ export default function ConvertUI(
>({});
const [state, setState] = useState<ConvertState>({type: 'idle'});
const [name, setName] = useState<string | null>(null);
- const [flipHorizontal, setFlipHorizontal] = useState(false);
+ const [flipHorizontal, setFlipHorizontal] = useState(true);
const [flipVertical, setFlipVertical] = useState(false);
+ const [enableConvert, setEnableConvert] = useState(true);
+ const [enableRotateOrMirrow, setEnableRotateOrMirror] = useState<
+ 'rotate' | 'mirror' | null
+ >(null);
+
+ const [rotation, setRotation] = useState(90);
+
+ const actualRotation = useMemo(() => {
+ if (enableRotateOrMirrow !== 'mirror') {
+ // TODO: Native rotation
+ return 0;
+ }
+
+ return rotation;
+ }, [enableRotateOrMirrow, rotation]);
- const supportedConfigs = useSupportedConfigs({container, tracks});
+ const supportedConfigs = useSupportedConfigs({container, tracks, logLevel});
const setVideoConfigIndex = useCallback((trackId: number, i: number) => {
_setVideoConfigIndex((prev) => ({
@@@ -106,8 -93,7 +109,8 @@@
videoFrames++;
return flipped;
},
- logLevel: 'verbose',
+ rotate: actualRotation,
+ logLevel,
onProgress: (s) => {
setState({
type: 'in-progress',
@@@ -199,7 -184,6 +202,8 @@@
supportedConfigs,
audioConfigIndex,
videoConfigIndex,
+ enableRotateOrMirrow,
++ logLevel,
]);
const cancel = useCallback(() => {