Flashphoner.createSession({urlServer: urlServer}).on(SESSION_STATUS.ESTABLISHED, function (session) {
publishStream(session);
}).on(SESSION_STATUS.DISCONNECTED, function () {
setStatus(SESSION_STATUS.DISCONNECTED);
onStopped();
}).on(SESSION_STATUS.FAILED, function () {
setStatus(SESSION_STATUS.FAILED);
onStopped();
});
function publishStream(session) {
session.createStream({
name: streamName,
display: recordVideo,
constraints: constraints,
mediaConnectionConstraints: mediaConnectionConstraints,
/*sdpHook: rewriteSdp,*/
transport: transportInput,
cvoExtension: cvo,
stripCodecs: strippedCodecs,
record: true,
receiveVideo: false,
receiveAudio: false
}).on(STREAM_STATUS.PUBLISHING, function (stream) {
setStatus(stream.status());
onStarted(stream);
}).on(STREAM_STATUS.UNPUBLISHED, function (stream) {
setStatus(stream.status());
showDownloadLink(stream.getRecordInfo());
onStopped();
}).on(STREAM_STATUS.FAILED, function (stream) {
setStatus(stream.status(), stream.getInfo());
addStatusLog(stream);
showDownloadLink(stream.getRecordInfo());
onStopped();
}).publish();
}