mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-10 19:33:37 +08:00
Ports functionality from 10+ separate plugins into ECC so users only need one plugin installed. Consolidates: pr-review-toolkit, feature-dev, commit-commands, hookify, code-simplifier, security-guidance, frontend-design, explanatory-output-style, and personal skills. New agents (8): code-architect, code-explorer, code-simplifier, comment-analyzer, conversation-analyzer, pr-test-analyzer, silent-failure-hunter, type-design-analyzer New commands (9): commit, commit-push-pr, clean-gone, review-pr, feature-dev, hookify, hookify-list, hookify-configure, hookify-help New skills (8): frontend-design, hookify-rules, github-ops, knowledge-ops, lead-intelligence, oura-health, pmx-guidelines, remotion Enhanced skills (8): article-writing, content-engine, market-research, investor-materials, investor-outreach, x-api, security-scan, autonomous-loops — merged with personal skill content New hook: security-reminder.py (pattern-based OWASP vulnerability warnings on file edits) Totals: 36 agents, 69 commands, 128 skills, 29 hook scripts
76 lines
1.5 KiB
Markdown
76 lines
1.5 KiB
Markdown
---
|
|
name: can-decode
|
|
description: Check if a video can be decoded by the browser using Mediabunny
|
|
metadata:
|
|
tags: decode, validation, video, audio, compatibility, browser
|
|
---
|
|
|
|
# Checking if a video can be decoded
|
|
|
|
Use Mediabunny to check if a video can be decoded by the browser before attempting to play it.
|
|
|
|
## The `canDecode()` function
|
|
|
|
This function can be copy-pasted into any project.
|
|
|
|
```tsx
|
|
import { Input, ALL_FORMATS, UrlSource } from "mediabunny";
|
|
|
|
export const canDecode = async (src: string) => {
|
|
const input = new Input({
|
|
formats: ALL_FORMATS,
|
|
source: new UrlSource(src, {
|
|
getRetryDelay: () => null,
|
|
}),
|
|
});
|
|
|
|
try {
|
|
await input.getFormat();
|
|
} catch {
|
|
return false;
|
|
}
|
|
|
|
const videoTrack = await input.getPrimaryVideoTrack();
|
|
if (videoTrack && !(await videoTrack.canDecode())) {
|
|
return false;
|
|
}
|
|
|
|
const audioTrack = await input.getPrimaryAudioTrack();
|
|
if (audioTrack && !(await audioTrack.canDecode())) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
};
|
|
```
|
|
|
|
## Usage
|
|
|
|
```tsx
|
|
const src = "https://remotion.media/video.mp4";
|
|
const isDecodable = await canDecode(src);
|
|
|
|
if (isDecodable) {
|
|
console.log("Video can be decoded");
|
|
} else {
|
|
console.log("Video cannot be decoded by this browser");
|
|
}
|
|
```
|
|
|
|
## Using with Blob
|
|
|
|
For file uploads or drag-and-drop, use `BlobSource`:
|
|
|
|
```tsx
|
|
import { Input, ALL_FORMATS, BlobSource } from "mediabunny";
|
|
|
|
export const canDecodeBlob = async (blob: Blob) => {
|
|
const input = new Input({
|
|
formats: ALL_FORMATS,
|
|
source: new BlobSource(blob),
|
|
});
|
|
|
|
// Same validation logic as above
|
|
};
|
|
```
|