Date: Fri, 29 Mar 2024 12:32:17 +0100 (CET) Message-ID: <45232226.47477.1711711937312@docs.flashphoner.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_47476_1211846828.1711711937312" ------=_Part_47476_1211846828.1711711937312 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Realtime stream information can be obtained using Websocket API.
To connect to backend server for obtaining realtime metric values, do th= e following:
1. Establish Websock= et API connection
2. Subscribe to /stream/nodeId/mediaId event by sending the message=
SUBSCRIBE id:sub-2 destination:/stream/3/ca77c700-8e86-11e9-8386-dbc3d191a79a =20 ^@=20
Where
After that, client starts receiving STOMP messages in plain text
MESSAGE destination:/stream/3/ca77c700-8e86-11e9-8386-dbc3d191a79a content-type:application/json;charset=3DUTF-8 subscription:sub-2 message-id:3-50 content-length:1339 [{"VIDEO_SYNC":1560504547907,"VIDEO_CODEC":119,"VIDEO_NACK":0,"VIDEO_PLI":0= ,"VIDEO_RATE":571616,"VIDEO_WIDTH":320,"VIDEO_HEIGHT":240,"VIDEO_FPS":30,"t= imestamp":1560504547917},{"AUDIO_SYNC":1560504547890,"AUDIO_CODEC":111,"AUD= IO_RATE":26664,"timestamp":1560504547923,"AUDIO_LOST":0},{"AUDIO_SYNC":1560= 504548010,"AUDIO_CODEC":111,"AUDIO_RATE":27040,"timestamp":1560504548040,"A= UDIO_LOST":0},{"VIDEO_SYNC":1560504548099,"VIDEO_CODEC":119,"VIDEO_NACK":0,= "VIDEO_PLI":0,"VIDEO_RATE":577416,"VIDEO_WIDTH":320,"VIDEO_HEIGHT":240,"VID= EO_FPS":30,"timestamp":1560504548119},{"AUDIO_SYNC":1560504548130,"AUDIO_CO= DEC":111,"AUDIO_RATE":26624,"timestamp":1560504548167,"AUDIO_LOST":0},{"AUD= IO_SYNC":1560504548250,"AUDIO_CODEC":111,"AUDIO_RATE":27976,"timestamp":156= 0504548282,"AUDIO_LOST":0},{"VIDEO_SYNC":1560504548307,"VIDEO_CODEC":119,"V= IDEO_NACK":0,"VIDEO_PLI":0,"VIDEO_RATE":581968,"VIDEO_WIDTH":320,"VIDEO_HEI= GHT":240,"VIDEO_FPS":31,"timestamp":1560504548318},{"AUDIO_SYNC":1560504548= 370,"AUDIO_CODEC":111,"AUDIO_RATE":28128,"timestamp":1560504548404,"AUDIO_L= OST":0},{"VIDEO_SYNC":1560504548499,"VIDEO_CODEC":119,"VIDEO_NACK":0,"VIDEO= _PLI":0,"VIDEO_RATE":583032,"VIDEO_WIDTH":320,"VIDEO_HEIGHT":240,"VIDEO_FPS= ":31,"timestamp":1560504548506},{"AUDIO_SYNC":1560504548490,"AUDIO_CODEC":1= 11,"AUDIO_RATE":29568,"timestamp":1560504548522,"AUDIO_LOST":0}]=20
or in JSON using STOMP.js library= p>
{ "command": "MESSAGE", "headers": { "content-length": "1339", "message-id": "3-50", "subscription": "sub-2", "content-type": "application/json;charset=3DUTF-8", "destination": "/stream/3/ca77c700-8e86-11e9-8386-dbc3d191a79a" }, "body": [ { "VIDEO_SYNC": 1560504547907, "VIDEO_CODEC": 119, "VIDEO_NACK": 0, "VIDEO_PLI": 0, "VIDEO_RATE": 571616, "VIDEO_WIDTH": 320, "VIDEO_HEIGHT": 240, "VIDEO_FPS": 30, "timestamp": 1560504547917 }, { "AUDIO_SYNC": 1560504547890, "AUDIO_CODEC": 111, "AUDIO_RATE": 26664, "timestamp": 1560504547923, "AUDIO_LOST": 0 }, { "AUDIO_SYNC": 1560504548010, "AUDIO_CODEC": 111, "AUDIO_RATE": 27040, "timestamp": 1560504548040, "AUDIO_LOST": 0 }, { "VIDEO_SYNC": 1560504548099, "VIDEO_CODEC": 119, "VIDEO_NACK": 0, "VIDEO_PLI": 0, "VIDEO_RATE": 577416, "VIDEO_WIDTH": 320, "VIDEO_HEIGHT": 240, "VIDEO_FPS": 30, "timestamp": 1560504548119 }, { "AUDIO_SYNC": 1560504548130, "AUDIO_CODEC": 111, "AUDIO_RATE": 26624, "timestamp": 1560504548167, "AUDIO_LOST": 0 }, { "AUDIO_SYNC": 1560504548250, "AUDIO_CODEC": 111, "AUDIO_RATE": 27976, "timestamp": 1560504548282, "AUDIO_LOST": 0 }, { "VIDEO_SYNC": 1560504548307, "VIDEO_CODEC": 119, "VIDEO_NACK": 0, "VIDEO_PLI": 0, "VIDEO_RATE": 581968, "VIDEO_WIDTH": 320, "VIDEO_HEIGHT": 240, "VIDEO_FPS": 31, "timestamp": 1560504548318 }, { "AUDIO_SYNC": 1560504548370, "AUDIO_CODEC": 111, "AUDIO_RATE": 28128, "timestamp": 1560504548404, "AUDIO_LOST": 0 }, { "VIDEO_SYNC": 1560504548499, "VIDEO_CODEC": 119, "VIDEO_NACK": 0, "VIDEO_PLI": 0, "VIDEO_RATE": 583032, "VIDEO_WIDTH": 320, "VIDEO_HEIGHT": 240, "VIDEO_FPS": 31, "timestamp": 1560504548506 }, { "AUDIO_SYNC": 1560504548490, "AUDIO_CODEC": 111, "AUDIO_RATE": 29568, "timestamp": 1560504548522, "AUDIO_LOST": 0 } ] }=20
The messages contain metric values acquired from the node where the stre= am is published or played.
To stop receiving metrics in realtime, the following message should be s= ent to unsubscribe
UNSUBSCRIBE id:sub-2 ^@=20
Maximum metrics count in one STOMP message is set with the following par= ameter in wcsoam.properties
stomp_max_metrics= =3D10=20
Connection timeout is set with the following parameter
stomp_max_timeout= =3D1000=20
A different metrics sets can be aquired to backend server with a different rate defined by profile. If metric value, VIDEO_HEIGH= T for example, does not change while stream is published, then messages wit= h this metric will be send to subscriber at least as rate defines. If metri= c value (VIDEO_RATE) changes, messages with this metric can be send to subs= criber upon changes.
For example, if stream data are collected by profile including one stati= c metric VIDEO_WIDTH with rate 30
https://hostname:80= 90/api/profile/create { "name": "profile1", "rate": "30", "metrics": ["2"], "rules": ["1"] }=20
and maximum metrics count 1 per one message
stomp_max_metrics= =3D1=20
the messages will be send to subscriber near 1 per second.
When changing rate to 600
https://hostname:80= 90/api/profile/update { "id": "2", "name": "profile1", "rate": "600", "metrics": ["2"], "rules": ["1"] }=20
the messages will be send to subscriber near 1 per 20 seconds.
Now, extending metrics set to 4 static metrics VIDEO_WIDTH, VIDEO_HEIGHT, VIDEO_CODEC, AUDIO_CODEC
https://hostname:80= 90/api/profile/update { "id": "2", "name": "profile1", "rate": "600", "metrics": ["2","3","9","13"], "rules": ["1"] }=20
the messages will be send to subscriber near 1 per 5 seconds.
When stream data are collected by profile including two metrics
https://hostname:80= 90/api/profile/create { "name": "profile2", "rate": "30", "metrics": ["4","11"], "rules": ["1"] }=20
and maximum metrics count 1 per one message
stomp_max_metrics= =3D1=20
for the stream published to WCS using RTMP, the messages will be send to= subscriber near 1-2 per second.