Karan Adhikari commited on
Update live stream filtering logic
Browse filesFilter live streams to include only those started within the last 15 seconds.
Backend/fastapi/templates/dashboard.html
CHANGED
|
@@ -672,7 +672,13 @@
|
|
| 672 |
const allStreams = data.active_streams || [];
|
| 673 |
const container = document.getElementById('active-streams-container');
|
| 674 |
// Only show streams that are actively sending data
|
| 675 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 676 |
|
| 677 |
if (liveStreams.length === 0) {
|
| 678 |
container.innerHTML = `<div class="p-8 text-center bg-gray-50 border border-dashed rounded-lg">
|
|
@@ -928,4 +934,4 @@
|
|
| 928 |
{% endif %}
|
| 929 |
});
|
| 930 |
</script>
|
| 931 |
-
{% endblock %}
|
|
|
|
| 672 |
const allStreams = data.active_streams || [];
|
| 673 |
const container = document.getElementById('active-streams-container');
|
| 674 |
// Only show streams that are actively sending data
|
| 675 |
+
const now = Date.now() / 1000;
|
| 676 |
+
|
| 677 |
+
const liveStreams = allStreams.filter(s =>
|
| 678 |
+
s.status === 'active' &&
|
| 679 |
+
(s.total_bytes || 0) > 0 &&
|
| 680 |
+
(now - (s.start_ts || now)) < 15
|
| 681 |
+
);
|
| 682 |
|
| 683 |
if (liveStreams.length === 0) {
|
| 684 |
container.innerHTML = `<div class="p-8 text-center bg-gray-50 border border-dashed rounded-lg">
|
|
|
|
| 934 |
{% endif %}
|
| 935 |
});
|
| 936 |
</script>
|
| 937 |
+
{% endblock %}
|