Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit df73775

Browse files
xiandeatinteljianjunz
authored andcommitted
Added connection parameters for streaming-outs (#111)
1 parent da19bfe commit df73775

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

src/samples/conference/samplertcservice.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,12 @@ app.get('/rooms/:room/streaming-outs', function(req, res) {
386386
app.post('/rooms/:room/streaming-outs', function(req, res) {
387387
'use strict';
388388
var room = req.params.room,
389+
protocol = req.body.protocol,
389390
url = req.body.url,
391+
parameters = req.body.parameters,
390392
media = req.body.media;
391393

392-
icsREST.API.startStreamingOut(room, url, media, function(info) {
394+
icsREST.API.startStreamingOut(room, protocol, url, parameters, media, function(info) {
393395
res.send(info);
394396
}, function(err) {
395397
res.send(err);

src/sdk/rest/API.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ OWT_REST.API = (function(OWT_REST) {
857857

858858
/*
859859
* * @callback onStreamingOutList
860-
* * @param {Array.<id: string, url: string, media: Object>} streamingOutList -The list of streaming-outs.
860+
* * @param {Array.<id: string, protocol: string, url: string, parameters: Object, media: Object>} streamingOutList -The list of streaming-outs.
861861
* * @param {Object} streamingOutList[x].media -The media description of the streaming-out, which must follow the definition of object "MediaSubOptions" in section "3.3.11 Participant Starts a Subscription" in "Client-Portal Protocol.md" doc.
862862
*/
863863
/**
@@ -887,21 +887,36 @@ OWT_REST.API = (function(OWT_REST) {
887887
* * @callback onStartingStreamingOutOK
888888
* * @param {Object} streamingOutInfo -The object containing the information of the external streaming-out.
889889
* * @param {string} streamingOutInfo.id -The streaming-out ID.
890+
* * @param {string} streamingOutInfo.protocol -The streaming-out protocol.
890891
* * @param {string} streamingOutInfo.url -The URL of the target streaming-out.
892+
* * @param {string} streamingOutInfo.parameters -The connection parameters of the target streaming-out.
891893
* * @param {Object} streamingOutInfo.media -The media description of the streaming-out, which must follow the definition of object "MediaSubOptions" in section "3.3.11 Participant Starts a Subscription" in "Client-Portal Protocol.md" doc.
892894
*/
893895
/**
894896
* @function startStreamingOut
895897
* @desc This function starts a streaming-out to the specified room.
896898
* @memberOf OWT_REST.API
897899
* @param {string} room -Room ID.
900+
* @param {string} protocol -Streaming-out protocol.
898901
* @param {string} url -The URL of the target streaming-out.
902+
* @param {Object} parameters -The connection parameters of the target streaming-out.
903+
* @param {string} parameters.method -The HTTP(s) method to create file on streaming servers, 'PUT' or 'POST, 'PUT' by default.
904+
* @param {string} parameters.hlsTime -The hls segment length in seconds, 2 by default, required in case protocol is 'hls'.
905+
* @param {string} parameters.hlsListSize -The maximum number of playlist entries, 5 by default, required in case protocol is 'hls'.
906+
* @param {string} parameters.dashSegDuration -The segment length in seconds, 2 by default, required in case protocol is 'dash'.
907+
* @param {string} parameters.dashWindowSize -The maximum number of segments kept in the manifest, 5 by default, required in case protocol is 'dash'.
899908
* @param {Object} media -The media description of the streaming-out, which must follow the definition of object "MediaSubOptions" in section "3.3.11 Participant Starts a Subscription" in "Client-Portal Protocol.md" doc.
900909
* @param {onStartingStreamingOutOK} callback -Callback function on success
901910
* @param {function} callbackError -Callback function on error
902911
* @example
903912
var roomId = '51c10d86909ad1f939000001';
904-
var url = 'rtmp://USER:PASS@localhost:1935/live';
913+
var protocol = 'hls'
914+
var url = 'https://USER:PASS@localhost:443/live.m3u8';
915+
var parameters = {
916+
method: 'PUT',
917+
hlsTime: 2,
918+
hlsListSize: 5
919+
},
905920
var media = {
906921
audio: {
907922
from: '7652773772543651'
@@ -913,16 +928,18 @@ OWT_REST.API = (function(OWT_REST) {
913928
}
914929
}
915930
};
916-
OWT_REST.API.startStreamingOut(roomId, url, media, function(streamingOut) {
931+
OWT_REST.API.startStreamingOut(roomId, protocol, url, parameters, media, function(streamingOut) {
917932
console.log('Streaming-out:', streamingOut);
918933
}, function(status, error) {
919934
// HTTP status and error
920935
console.log(status, error);
921936
});
922937
*/
923-
var startStreamingOut = function(room, url, media, callback, callbackError) {
938+
var startStreamingOut = function(room, protocol, url, parameters, media, callback, callbackError) {
924939
var options = {
940+
protocol: protocol,
925941
url: url,
942+
parameters: parameters,
926943
media: media
927944
};
928945

0 commit comments

Comments
 (0)