Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
const PROBE_TIMEOUT_MS = 5000;
/** Video duration in seconds from the file's metadata; null when undecodable or timed out. */
export const probeVideoDuration = (file: File): Promise<number | null> =>
new Promise((resolve) => {
const video = document.createElement('video');
const url = URL.createObjectURL(file);
// Whichever fires first — metadata, error or timeout — settles the promise and releases the element.
const finish = (duration: number | null): void => {
clearTimeout(timer);
video.removeAttribute('src');
video.load();
URL.revokeObjectURL(url);
resolve(duration);
};
const timer = setTimeout(() => finish(null), PROBE_TIMEOUT_MS);
video.preload = 'metadata';
video.onloadedmetadata = () => finish(Number.isFinite(video.duration) && video.duration > 0 ? video.duration : null);
video.onerror = () => finish(null);
video.src = url;
});