Skip to content

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

Description

@regisroots

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions