restreamer-ui-v2/scripts/trace_probe.sh
Cesar Mendivil 00e98a19b3 feat: add InternalWHIP component and associated tests
- Implemented the InternalWHIP component for managing WHIP server configurations.
- Added functionality to load live WHIP state from Core and handle OBS URL generation.
- Included polling for active streams and notifying parent components of state changes.
- Created comprehensive tests for the InternalWHIP component covering various scenarios including fallback mechanisms and state changes.

test: add integration tests for WHIP source component

- Developed end-to-end tests for the InternalWHIP component to verify its behavior under different configurations.
- Ensured that the component correctly handles the loading of WHIP state, displays appropriate messages, and emits the correct onChange events.

test: add Settings WHIP configuration tests

- Implemented tests for the WHIP settings tab to validate loading and saving of WHIP configurations.
- Verified that the correct values are sent back to the Core when the user saves changes.
- Ensured that the UI reflects the current state of the WHIP configuration after Core restarts or changes.
2026-03-14 12:27:53 -07:00

71 lines
1.9 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
# Trace probe script for Restreamer Core
# Usage: ./scripts/trace_probe.sh <CHANNEL_ID> <SOURCE_URL>
# Reads REACT_APP_CORE_URL from .env if present. Optionally set API_TOKEN env var.
# load .env if exists (simple parser)
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
CORE_URL=${REACT_APP_CORE_URL:-http://localhost:8080}
API_TOKEN=${API_TOKEN:-}
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <CHANNEL_ID> <SOURCE_URL>"
echo "Example: $0 channel1 http://example.com/stream.m3u8"
exit 2
fi
CHANNEL_ID=$1
SOURCE_URL=$2
PROBE_ID="${CHANNEL_ID}_probe_$(date +%s)"
# Build JSON payload for the probe process
read -r -d '' PAYLOAD <<EOF
{
"type": "ffmpeg",
"id": "${PROBE_ID}",
"reference": "${CHANNEL_ID}",
"input": [
{
"id": "input_0",
"address": "${SOURCE_URL}",
"options": ["-fflags", "+genpts", "-thread_queue_size", "512", "-probesize", "5000000", "-analyzeduration", "20000000", "-re"]
}
],
"output": [
{
"id": "output_0",
"address": "-",
"options": ["-dn", "-sn", "-codec", "copy", "-f", "null"]
}
],
"options": [],
"autostart": false,
"reconnect": false
}
EOF
AUTH_HEADER=()
if [ -n "$API_TOKEN" ]; then
AUTH_HEADER+=( -H "Authorization: Bearer ${API_TOKEN}" )
fi
echo "Core URL: ${CORE_URL}"
echo "Probe ID: ${PROBE_ID}"
echo "1) Creating probe process..."
curl -s -X POST "${CORE_URL}/api/v3/process" -H "Content-Type: application/json" "${AUTH_HEADER[@]}" -d "$PAYLOAD" | jq '.' || true
echo "\n2) Running probe (this may take a few seconds)..."
# Probe endpoint returns JSON result when finished
curl -s "${CORE_URL}/api/v3/process/${PROBE_ID}/probe" "${AUTH_HEADER[@]}" | jq '.' || true
echo "\n3) Deleting probe process..."
curl -s -X DELETE "${CORE_URL}/api/v3/process/${PROBE_ID}" "${AUTH_HEADER[@]}" | jq '.' || true
echo "\nDone. Check Core logs or /api/v3/process/<id>/report if you need more details."