Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
real-time-tv
Advanced tools
built with Create React App redux and socket.io.
Real-Time TV then open another tab to the same url and paste a youtube url in and watch the rtc magic happen.
npm i --save real-time-tv
Unfortunately The Component was ejected as such, to enable the css it has to be used with an ejected app using css modules plugin.
or clone the git repo and run in dev server port is set to 5000.
npm install
npm start
`newVideo` event
`isReady` event
`stateChange` event
`placeChange` event
here is the example server responding to the events
io.on("connection", socket => {
const userId = socket.id;
connIds.push(userId);
// newVideo event
socket.on("newVideo", vidObj => {
const objSend = {
url: vidObj.url,
id: vidObj.vidId,
screenState: vidObj.screenState,
controlId: vidObj.controlId
};
io.emit("updateVideo", objSend);
});
// isReady when all are ready emit allIsReady
socket.on("isReady", socketId => {
clientIds.push(socketId.ids);
let objSend = {
msg: null
};
const clients = Object.keys(io.sockets.sockets);
promisePoller({
taskFn: () => {
return new Promise((resolve, reject) => {
if (clients.length === clientIds.length) {
resolve(true);
} else {
reject(`${clients.length - clientIds.length}`);
}
});
},
interval: 500,
retries: 5,
})
.then(poll => {
if (poll === true) {
io.emit("allIsReady");
}
}).catch(err => {
objSend.msg = `${err[err.length]} user(s) not connected.`;
io.emit("allIsReady", objSend);
});
});
// stateChange event
socket.on("stateChange", stateObj => {
const objSend = {
state: stateObj.state
};
socket.broadcast.emit("updateState", objSend);
});
// placeChange event
socket.on("placeChange", placeObj => {
const objSend = {
place: placeObj.ytPlace
};
io.emit("updatePlace", objSend);
});
socket.on("disconnect", () => {
console.log(`user disconnected`);
const id = socket.id;
const newConnIdArr = filterIds(connIds, id);
const newClientIdArr = filterIds(clientIds, id);
connIds = newConnIdArr;
clientIds = newClientIdArr;
});
});
FAQs
Real-time video player component built with react and socket.io
The npm package real-time-tv receives a total of 0 weekly downloads. As such, real-time-tv popularity was classified as not popular.
We found that real-time-tv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.