In Node-Media-Server v4.0.7, event handling seems to be broken. In previous versions (e.g., v2.7.4), I was able to use:
nms.on("prePublish", (id, streamPath, args) => {
console.log(`Stream started: ${streamPath}`);
});
In v4.0.7, nms.on() seems to not exist.
This results in: TypeError: NMS.on is not a function
However, when I downgraded to v2.7.4, everything worked correctly.
To reproduce:
-
Install v4.0.7:
npm install node-media-server@4.0.7
-
Try registering an event:
const NodeMediaServer = require('node-media-server');
const nms = new NodeMediaServer({});
nms.run();
nms.on("prePublish", (id, streamPath, args) => {
console.log(`Stream started: ${streamPath}`);
});
- Error occurs:
TypeError: nms.on is not a function
Expected Behavior
nms.on() should exist and work as expected.
Actual Behavior
nms.on() seems to not exist in v4.
Downgrading to v@2.7.4 restores normal behavior.
Environment
Node.js Version: v20.17.0
node-media-server Version: 4.0.7
OS: Windows 10 Pro 22H2 (Build: 19045.5371)
In Node-Media-Server v4.0.7, event handling seems to be broken. In previous versions (e.g., v2.7.4), I was able to use:
In v4.0.7, nms.on() seems to not exist.
This results in:
TypeError: NMS.on is not a functionHowever, when I downgraded to v2.7.4, everything worked correctly.
To reproduce:
Install v4.0.7:
npm install node-media-server@4.0.7Try registering an event:
TypeError: nms.on is not a functionExpected Behavior
nms.on() should exist and work as expected.
Actual Behavior
nms.on() seems to not exist in v4.
Downgrading to v@2.7.4 restores normal behavior.
Environment
Node.js Version: v20.17.0
node-media-server Version: 4.0.7
OS: Windows 10 Pro 22H2 (Build: 19045.5371)