Upgraded call playback debug messages

This commit is contained in:
Luke Berndt
2023-02-03 17:48:16 -05:00
parent 5671dc1180
commit c087e9796f
3 changed files with 18 additions and 11 deletions

View File

@@ -37,7 +37,7 @@ const io = require('socket.io')(server, {
} }
}); });
var Twitter = require('twitter-lite'); //var Twitter = require('twitter-lite');
//io.origins('*:*'); //io.origins('*:*');
@@ -273,8 +273,6 @@ app.use(function (err, req, res, next) {
}); });
app.get('/:shortName/clients', get_clients);
app.get('/clients', get_clients);
function notify_clients(call) { function notify_clients(call) {
call.type = "calls"; call.type = "calls";
@@ -392,7 +390,7 @@ io.sockets.on('connection', function (client) {
if (clients[client.id]) { if (clients[client.id]) {
clients[client.id].active = false; clients[client.id].active = false;
} else { } else {
console.error("Error - Socket.io [Stop] either client not found "); console.error("Error - Socket.io [Stop] Client not found ");
} }
}); });
client.on('disconnect', function () { client.on('disconnect', function () {

View File

@@ -82,11 +82,14 @@ function CallPlayer(props) {
if (autoPlay && (currentIndex > 0)) { if (autoPlay && (currentIndex > 0)) {
const nextCallId = callsData.ids[currentIndex - 1]; const nextCallId = callsData.ids[currentIndex - 1];
const nextCall = callsData.entities[nextCallId]; const nextCall = callsData.entities[nextCallId];
console.log("Autoplaying next call, current Index is: " + currentIndex + " isPlaying is: " + isPlaying )
setCurrentCall(nextCall); setCurrentCall(nextCall);
dispatch(playedCall(nextCall._id)); dispatch(playedCall(nextCall._id));
setIsPlaying(true); setIsPlaying(true);
} else { } else {
if (!autoPlay) {
console.log("Not playing because Autoplay is false - current index is: " + currentIndex)
}
setIsPlaying(false); setIsPlaying(false);
} }
} else { } else {
@@ -114,15 +117,19 @@ function CallPlayer(props) {
// we should only set the selectCallId to be the current call when AutoPlay is selected // we should only set the selectCallId to be the current call when AutoPlay is selected
// and when there isn't another call already playing // and when there isn't another call already playing
useEffect(() => { useEffect(() => {
console.log("New selected call: " + selectCallId + " IsPlaying: " + isPlaying + " autoPlay: " + autoPlay );
if (selectCallId && callsData && !isPlaying && autoPlay) { if (selectCallId && callsData && !isPlaying && autoPlay) {
const call = callsData.entities[selectCallId]; const call = callsData.entities[selectCallId];
if (call) { if (call) {
const time = new Date(call.time);
console.log("Playing Selected Call: " + call._id + " Start Time: " + time.toLocaleTimeString() );
setIsPlaying(true); setIsPlaying(true);
setCurrentCall(call); setCurrentCall(call);
dispatch(playedCall(call._id)); dispatch(playedCall(call._id));
} }
} }
}, [selectCallId, callsData]) }, [selectCallId])
return ( return (

View File

@@ -114,8 +114,8 @@ function Calls(props) {
} }
setSelectCallId(message._id); setSelectCallId(message._id);
dispatch(addCall(message)); dispatch(addCall(message));
const time = new Date(message.time);
console.log("Got Socket Message: " + message._id); console.log("Got Socket Message: " + message._id + " Start Time: " + time.toLocaleTimeString() );
break break
default: default:
break break
@@ -124,7 +124,7 @@ function Calls(props) {
const startSocket = () => { const startSocket = () => {
const filter = getFilterDescription(); const filter = getFilterDescription();
console.log("Starting Socket"); console.log("Starting Socket - Filter Code: " + filter.code + " Filter Type: " + filter.type);
socket.emit("start", { socket.emit("start", {
filterCode: filter.code, filterCode: filter.code,
filterType: filter.type, filterType: filter.type,
@@ -200,10 +200,12 @@ function Calls(props) {
const handleNewer = () => { const handleNewer = () => {
if (positionRef.current && !live) { if (positionRef.current) {
pageYOffset.current = {direction: "top", position: positionRef.current.clientHeight}; pageYOffset.current = {direction: "top", position: positionRef.current.clientHeight};
} }
dispatch(getNewerCalls({})); if (!live) {
dispatch(getNewerCalls({}));
}
} }
const handleOlder = () => { const handleOlder = () => {