@@ -855,6 +855,86 @@ OWT_REST.API = (function(OWT_REST) {
855
855
} , callbackError ) ;
856
856
} ;
857
857
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 of IPCamera.
866
+ * @param {string } connection.mode -SRT connection mode, "listener" or "caller", "listener" by default.
867
+ * @param {number } connection.latency -The SRT latency 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 = 'rtsp://10.239.44.7:554/rtsp_tunnel%3Fh26x=4%26line=1';
876
+ var transport = {
877
+ url = 'srt://10.239.44.7:1234',
878
+ mode: 'listener',
879
+ latency: 100
880
+ };
881
+ var media = {
882
+ audio: 'auto',
883
+ video: true
884
+ };
885
+
886
+ OWT_REST.API.startStreamingIn(roomId, url, transport, media, function(stream) {
887
+ console.log('Streaming-In:', stream);
888
+ }, function(status, error) {
889
+ // HTTP status and error
890
+ console.log(status, error);
891
+ });
892
+ */
893
+ var startStreamingInSRT = function ( room , url , options , media , callback , callbackError ) {
894
+ console . log ( "Send streaming in srt request" ) ;
895
+ var pub_req = {
896
+ connection : {
897
+ url : url ,
898
+ mode : options . mode ,
899
+ latency : options . latency
900
+ } ,
901
+ media : media
902
+ } ;
903
+ send ( 'POST' , 'rooms/' + room + '/streaming-ins-srt/' , pub_req , function ( streamRtn ) {
904
+ var st = JSON . parse ( streamRtn ) ;
905
+ callback ( st ) ;
906
+ } , callbackError ) ;
907
+ } ;
908
+
909
+
910
+ /**
911
+ * @function stopStreamingInSRT
912
+ * @desc This function stops the specified external streaming-in in the specified room.
913
+ * @memberOf OWT_REST.API
914
+ * @param {string } room -Room ID
915
+ * @param {string } stream -Stream ID
916
+ * @param {function } callback -Callback function on success
917
+ * @param {function } callbackError -Callback function on error
918
+ * @example
919
+ var roomId = '51c10d86909ad1f939000001';
920
+ var streamID = '878889273471677';
921
+ OWT_REST.API.stopStreamingIn(roomId, streamID, function(result) {
922
+ console.log('External streaming-in:', streamID, 'in room:', roomId, 'stopped');
923
+ }, function(status, error) {
924
+ // HTTP status and error
925
+ console.log(status, error);
926
+ });
927
+ */
928
+ var stopStreamingInSRT = function ( room , stream , callback , callbackError ) {
929
+ if ( typeof stream !== 'string' || stream . trim ( ) . length === 0 ) {
930
+ return callbackError ( 'Invalid stream ID' ) ;
931
+ }
932
+ send ( 'DELETE' , 'rooms/' + room + '/streaming-ins-srt/' + stream , undefined , function ( result ) {
933
+ callback ( result ) ;
934
+ } , callbackError ) ;
935
+ } ;
936
+
937
+
858
938
/*
859
939
* * @callback onStreamingOutList
860
940
* * @param {Array.<id: string, protocol: string, url: string, parameters: Object, media: Object> } streamingOutList -The list of streaming-outs.
@@ -1476,6 +1556,8 @@ OWT_REST.API = (function(OWT_REST) {
1476
1556
//Streaming-ins management.
1477
1557
startStreamingIn : startStreamingIn ,
1478
1558
stopStreamingIn : stopStreamingIn ,
1559
+ startStreamingInSRT : startStreamingInSRT ,
1560
+ stopStreamingInSRT : stopStreamingInSRT ,
1479
1561
1480
1562
//Streaming-outs management
1481
1563
getStreamingOuts : getStreamingOuts ,
0 commit comments