W3 MediaStreamTrack interface for Node.js.
This library is intended for Node.js applications or libraries that depend on the
MediaStreamTrack class. The exposed
MediaStreamTrack class does not internally manage any audio/video source. It's up to the application how to associate a
MediaStreamTrack instance with a real media stream/track.
$ npm install node-mediastreamtrack
const MediaStreamTrack = ;// or;const track = kind: 'audio' ;trackenabled = false;console;// => 'track.readyState: live, track.enabled: false'const clonedTrack = track;track;console;// => 'track.readyState: ended'console;// => 'clonedTrack.readyState: live'
MediaStreamTrack provides a class constructor that accepts an Object as parameter with the following fields.
const track = kind id label
kind: "audio" or "video" string.
id: Track unique identificator string. If not given, a random one is internally generated.
label: Track label (string).
track.remoteStop()emulates a stop generated remotely. It will fired "ended" event if not alread stopped.
track.remoteMute()emulates a mute generated remotely. It will fired "mute" event if not alread muted.
track.remoteUnmute()emulates a unmute generated remotely. It will fired "unmute" event if not alread muted.
const track = kind: 'video' ;track console;track;track;// => track ended (1)// => track ended (2)
Some W3 MediaStreamTrack properties and methods are not implemented:
- Do not export a
defaultbut a named