|
In the Web Simple, We call the function named 'swOpenEx' to open a SWVideoChanel and preview on a div, So this process include create a rtmp url and preview.
if want to create an url manually please follow steps below
1、 call function named 'swOpenEx' , it has 4 args , callback , div , prototype, media. you should set prototype with string "rtmp" . others follow the document or ack here
2、if callback function be called, it mean rtmp url creatd OK, and you can call function 'swGetUrl' to get it
function testOpenVideo() { var chanel = session.swGetPuChanel('PU_55AA0000', 0); if (chanel) { var result = chanel.swOpenEx({ div: null, //if you set a html div element id here we will preview on the div prototype: 'rtmp', //rtmp > hls // callback: function (options, response) { if(response.emms.code == jSW.RcCode.RC_CODE_S_OK){//if open successfully
var rtmpurl = chanel.swGetUrl()
alert(rtmpurl );
} document.getElementById('id_GetUrl_Button').disabled = 'false'; } }); if (result != jSW.RcCode.RC_CODE_S_OK) { alert('open error: ' + result); } } else { alert('没有该设备通道'); } }
|
|