@@ -855,6 +855,85 @@ OWT_REST.API = (function(OWT_REST) {
855855 } , callbackError ) ;
856856 } ;
857857
858+ /**
859+ ***
860+ * @function startStreamingInSRT
861+ * @desc This function adds an external SRT stream to the specified room.
862+ * @memberOf OWT_REST.API
863+ * @param {string } room -Room ID
864+ * @param {Object } connection -Transport parameters.
865+ * @param {string } connection.url -URL of the streaming source, e.g. the source URL.
866+ * @param {string } connection.mode -SRT connection mode, "listener" or "caller", "listener" by default.
867+ * @param {number } connection.latency -Timestamp-based Packet Delivery Delay with microseconds.
868+ * @param {Object } media Media requirements.
869+ * @param {string='auto' | boolean } media.video -If video is required, "auto" or true or false, "auto" by default.
870+ * @param {string='auto' | boolean } media.audio -If audio is required, "auto" or true or false, "auto" by default.
871+ * @param {onStartingStreamingInOK } callback -Callback function on success
872+ * @param {function } callbackError -Callback function on error
873+ * @example
874+ var roomId = '51c10d86909ad1f939000001';
875+ var url = 'srt://10.239.44.7:1234';
876+ var transport = {
877+ mode: 'caller',
878+ latency: 100000
879+ };
880+ var media = {
881+ audio: 'auto',
882+ video: true
883+ };
884+
885+ OWT_REST.API.startStreamingInSRT(roomId, url, transport, media, function(response) {
886+ console.log('Start SRT streaming-In response:', response);
887+ }, function(status, error) {
888+ // HTTP status and error
889+ console.log(status, error);
890+ });
891+ */
892+ var startStreamingInSRT = function ( room , url , options , media , callback , callbackError ) {
893+ console . log ( "Send streaming in srt request" ) ;
894+ var pub_req = {
895+ connection : {
896+ url : url ,
897+ mode : options . mode ,
898+ latency : options . latency
899+ } ,
900+ media : media
901+ } ;
902+ send ( 'POST' , 'rooms/' + room + '/streaming-ins-srt/' , pub_req , function ( streamRtn ) {
903+ var st = JSON . parse ( streamRtn ) ;
904+ callback ( st ) ;
905+ } , callbackError ) ;
906+ } ;
907+
908+
909+ /**
910+ * @function stopStreamingInSRT
911+ * @desc This function stops the specified external streaming-in in the specified room.
912+ * @memberOf OWT_REST.API
913+ * @param {string } room -Room ID
914+ * @param {string } stream -Stream ID
915+ * @param {function } callback -Callback function on success
916+ * @param {function } callbackError -Callback function on error
917+ * @example
918+ var roomId = '51c10d86909ad1f939000001';
919+ var streamID = '878889273471677';
920+ OWT_REST.API.stopStreamingInSRT(roomId, streamID, function(result) {
921+ console.log('External streaming-in:', streamID, 'in room:', roomId, 'stopped');
922+ }, function(status, error) {
923+ // HTTP status and error
924+ console.log(status, error);
925+ });
926+ */
927+ var stopStreamingInSRT = function ( room , stream , callback , callbackError ) {
928+ if ( typeof stream !== 'string' || stream . trim ( ) . length === 0 ) {
929+ return callbackError ( 'Invalid stream ID' ) ;
930+ }
931+ send ( 'DELETE' , 'rooms/' + room + '/streaming-ins-srt/' + stream , undefined , function ( result ) {
932+ callback ( result ) ;
933+ } , callbackError ) ;
934+ } ;
935+
936+
858937 /*
859938 * * @callback onStreamingOutList
860939 * * @param {Array.<id: string, protocol: string, url: string, parameters: Object, media: Object> } streamingOutList -The list of streaming-outs.
@@ -1476,6 +1555,8 @@ OWT_REST.API = (function(OWT_REST) {
14761555 //Streaming-ins management.
14771556 startStreamingIn : startStreamingIn ,
14781557 stopStreamingIn : stopStreamingIn ,
1558+ startStreamingInSRT : startStreamingInSRT ,
1559+ stopStreamingInSRT : stopStreamingInSRT ,
14791560
14801561 //Streaming-outs management
14811562 getStreamingOuts : getStreamingOuts ,
0 commit comments