Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send videofile to source TypeError: obs.send is not a function #345

Open
regisroots opened this issue Nov 24, 2023 · 1 comment
Open

Send videofile to source TypeError: obs.send is not a function #345

regisroots opened this issue Nov 24, 2023 · 1 comment

Comments

@regisroots
Copy link

How to send an .mp4 file to the source, obs.send no longer works, it gives me an error, below is my code.

const { default: OBSWebSocket } = require('obs-websocket-js');

const obs = new OBSWebSocket();

// Forneça a URL corretamente como uma string
obs.connect("ws://localhost:4455", "JWycd0W8eqxyOyYx")
.then(() => {
console.log("Conectado ao OBS Studio via WebSocket (sem autenticação)");

const sourceName = "NomeDoSeuSource";

const videoFilePath = "caminho/para/video.mp4";

const sourceSettings = {
  file: videoFilePath,
};

obs.send("SetSourceSettings", {
  sourceName: sourceName,
  sourceSettings: sourceSettings,
}).then(() => {
  console.log(`Arquivo de vídeo ${videoFilePath} configurado com sucesso para o source ${sourceName}`);
}).catch((error) => {
  console.error(`Erro ao configurar o arquivo de vídeo para o source ${sourceName}:`, error);
});

})
.catch((error) => {
console.error("Erro ao conectar ao OBS Studio:", error);
});

error TypeError: obs.send is not a function

@thasneem077
Copy link

thasneem077 commented Mar 31, 2024

did you resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants