fabioc Posted January 11 Share Posted January 11 Hi All, is there a REST API call to check whether a particular stream is being recorded? I start and stop recordings many times during a streaming session and I am wondering what happens if I try to record a stream which is currently recording. In general, it would be very useful to be able to query the recording status. Thanks. Link to comment Share on other sites More sharing options...
fabioc Posted January 11 Author Share Posted January 11 Hi All, is there a REST API call to check whether a particular stream is being recorded? I start and stop recordings many times during a streaming session and I am wondering what happens if I try to record a stream which is currently recording. In general, it would be very useful to be able to query the recording status. Thanks. Link to comment Share on other sites More sharing options...
fabioc Posted January 11 Author Share Posted January 11 Sorry, moved to a more appropriate channel. Can this post be deleted by the admin please? I don't seem to be able to do it myself. Thanks. 1 Link to comment Share on other sites More sharing options...
Yash Posted January 11 Share Posted January 11 Hi @fabioc I hope you are fine. Yes, there is a Rest API function to enable/disable recording. Please check https://antmedia.io/rest/#/BroadcastRestService/enableRecording If the recording status for the stream that you want to record again is already true, the response will be as follows: { "success": false, "message": "mp4 recording status is already: true", "dataId": null, "errorId": 0 } I hope it helps. Link to comment Share on other sites More sharing options...
fabioc Posted January 11 Author Share Posted January 11 Ah cool! The errorId doesn't change though, that could be used to detect why the recording failed. The first time I activate the recording I get: {"success":true,"message":"1673437660443","dataId":"eIp4B2dxdh2gONlEbMosR7iz","errorId":0} If I try to record again, I get: {"success":false,"message":"mp4 recording status is already: true","dataId":null,"errorId":0} Same thing if I try to stop the recording. First time: {"success":true,"message":"1673437660443","dataId":"eIp4B2dxdh2gONlEbMosR7iz","errorId":0} Second time: {"success":false,"message":"mp4 recording couldn't be stopped","dataId":null,"errorId":0} I guess just checking the value of 'success' is inconclusive as there can be a number of reasons why the operation failed. Thanks again. Link to comment Share on other sites More sharing options...
usama Posted January 11 Share Posted January 11 if you try to record the stream again which is already recording you will see a message something like this {"success":false,"message":"mp4 recording status is already: true","dataId":null,"errorId":0} Link to comment Share on other sites More sharing options...
fabioc Posted January 11 Author Share Posted January 11 Also, is there a way with the rest api to retrieve the name of the mp4 file created by the recording so that a link can be returned for accessing/downloading the video? Thanks. Link to comment Share on other sites More sharing options...
Yash Posted January 11 Share Posted January 11 @fabioc The recorded file is named after your stream ID. For VOD related rest APIs, please visit https://antmedia.io/rest/#/VoD Rest Service Link to comment Share on other sites More sharing options...
fabioc Posted January 11 Author Share Posted January 11 Hi, I am creating multiple recordings from the same stream and I am using the date and time in the filename, so the stream ID alone is only partially helpful. But I have noticed a VoD Id associated uniquely with each recording which is also the dataId returned by the start/stop recording api calls. Then, I can use the calls from the VoD Rest Service to get the full filename path. Thanks! Link to comment Share on other sites More sharing options...
Yash Posted January 12 Share Posted January 12 @fabioc Yes, you are right. It is also one way to get the correct mp4 file. Link to comment Share on other sites More sharing options...
Recommended Posts