mirror of
https://github.com/richard-austin/mp4f-ws-server
synced 2025-09-26 19:21:10 +08:00
Add Utf8ArrayToStr
This commit is contained in:
@@ -3,38 +3,19 @@
|
|||||||
"name": "Garden PTZ",
|
"name": "Garden PTZ",
|
||||||
"streams": {
|
"streams": {
|
||||||
"stream1": {
|
"stream1": {
|
||||||
"audio_bitrate": "16000",
|
"audio_bitrate": "8000",
|
||||||
"descr": "HD",
|
"descr": "HD",
|
||||||
"netcam_uri": "rtsp://192.168.0.23:554/11",
|
"netcam_uri": "rtsp://192.168.1.21:554/11",
|
||||||
"client_uri": "http://localhost:8081/live/stream?suuid=stream1",
|
"client_uri": "http://localhost:8081/live/stream?suuid=stream1",
|
||||||
"uri": "http://localhost:8081/ws/stream/suuid=stream1"
|
"uri": "http://localhost:8081/ws/stream/suuid=stream1"
|
||||||
},
|
},
|
||||||
"stream2": {
|
"stream2": {
|
||||||
"audio_bitrate": "0",
|
"audio_bitrate": "0",
|
||||||
"descr": "SD",
|
"descr": "SD",
|
||||||
"netcam_uri": "rtsp://192.168.0.23:554/12",
|
"netcam_uri": "rtsp://192.168.1.21:554/12",
|
||||||
"client_uri": "http://localhost:8081/live/stream?suuid=stream2",
|
"client_uri": "http://localhost:8081/live/stream?suuid=stream2",
|
||||||
"uri": "http://localhost:8081/ws/stream/suuid=stream2"
|
"uri": "http://localhost:8081/ws/stream/suuid=stream2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"camera2": {
|
|
||||||
"name": "Porch",
|
|
||||||
"streams": {
|
|
||||||
"stream3": {
|
|
||||||
"audio_bitrate": "0",
|
|
||||||
"descr": "HD",
|
|
||||||
"netcam_uri": "rtsp://192.168.0.26:554/11",
|
|
||||||
"client_uri": "http://localhost:8081/live/stream?suuid=stream3",
|
|
||||||
"uri": "http://localhost:8081/ws/stream/suuid=stream3"
|
|
||||||
},
|
|
||||||
"stream4": {
|
|
||||||
"audio_bitrate": "0",
|
|
||||||
"descr": "SD",
|
|
||||||
"netcam_uri": "rtsp://192.168.0.26:554/12",
|
|
||||||
"client_uri": "http://localhost:8081/live/stream?suuid=stream4",
|
|
||||||
"uri": "http://localhost:8081/ws/stream/suuid=stream4"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -118,6 +118,34 @@ https://stackoverflow.com/questions/54186634/sending-periodic-metadata-in-fragme
|
|||||||
buffering_sec_seek_distance = buffering_sec * 0.5;
|
buffering_sec_seek_distance = buffering_sec * 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Utf8ArrayToStr(array) {
|
||||||
|
let out, i, len, c;
|
||||||
|
let char2, char3;
|
||||||
|
out = "";
|
||||||
|
len = array.length;
|
||||||
|
i = 0;
|
||||||
|
while (i < len) {
|
||||||
|
c = array[i++];
|
||||||
|
switch (c >> 4) {
|
||||||
|
case 7:
|
||||||
|
out += String.fromCharCode(c);
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
char2 = array[i++];
|
||||||
|
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
char2 = array[i++];
|
||||||
|
char3 = array[i++];
|
||||||
|
out += String.fromCharCode(((c & 0x0F) << 12) |
|
||||||
|
((char2 & 0x3F) << 6) |
|
||||||
|
((char3 & 0x3F) << 0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
let started = false;
|
let started = false;
|
||||||
// consider these callbacks:
|
// consider these callbacks:
|
||||||
// - putPacket : called when websocket receives data
|
// - putPacket : called when websocket receives data
|
||||||
|
Reference in New Issue
Block a user