-
1.gitignore
-
43lib/controller/AddCameraNode.php
-
56lib/controller/addConnection.php
-
3lib/controller/dash/node_0.js
-
101lib/controller/dash/node_13.js
-
19lib/controller/dash/node_13.js.bk
-
5lib/controller/dash/node_5.js
-
30lib/controller/dash/tpl.js
-
111lib/controller/getDashBoardItems.php
-
2lib/controller/getOnvifCredentials.php
-
4lib/controller/getVideoFeed.php
-
BINlib/controller/lib - Shortcut.lnk
-
37lib/controller/listAndDiscoverOnvifProfiles.php
-
1lib/controller/listDiscoveredOnvifProfiles.php
-
14lib/controller/props/0_node_prop.js
-
28lib/javascript/jsapi_dynamic/rgoose_camera_editor.js
-
10lib/javascript/jsapi_dynamic/rgoose_dashboard.js
-
3lib/javascript/jsapi_dynamic/rgoose_devices_module.js
-
207lib/javascript/jsapi_dynamic/rgoose_main.js
-
258lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js
-
463lib/javascript/jsapi_static/rgoose_general.js
-
11lib/php/ui/UI_functions.php
-
226lib/php/video/zlMediaServerController.php
-
BINstyle/assets/7_node.png
-
BINstyle/assets/Untitleccd-1.png
-
BINstyle/assets/Untitled-8891.png
-
BINstyle/assets/adam-1.png
-
BINstyle/assets/adam-1b.png
-
BINstyle/assets/chch-1.png
-
BINstyle/assets/eth2uart.png
-
BINstyle/assets/zz-3.png
@ -1,9 +1,10 @@ |
|||||
{ |
{ |
||||
id: 'db_node_%%%NODEID%%%', |
id: 'db_node_%%%NODEID%%%', |
||||
frame: false, |
frame: false, |
||||
width: 200, |
|
||||
|
width: 258, |
||||
height: 200, |
height: 200, |
||||
border: true, |
border: true, |
||||
|
title: 'R-Goose Server', |
||||
items:[{ |
items:[{ |
||||
html: '<p>Server</p>' |
html: '<p>Server</p>' |
||||
}] |
}] |
||||
@ -1,10 +1,93 @@ |
|||||
{ |
|
||||
id: 'db_node_%%%NODEID%%%', |
|
||||
width: 400, |
|
||||
height: 400, |
|
||||
items:[{ |
|
||||
html: '<p>CAMERA</p><video id="hls-example" class="video-js vjs-default-skin" width="400" height="300" controls autoplay><source type="application/x-mpegURL" src="http://192.168.200.125:8081/argus/0/hls.m3u8"></video>', |
|
||||
|
|
||||
|
|
||||
}] |
|
||||
|
{ |
||||
|
id: 'db_node_%%%NODEID%%%', |
||||
|
//xxtype: 'panel',
|
||||
|
xtype: 'portlet', |
||||
|
//columnWidth:.33,
|
||||
|
//layout: 'fit',
|
||||
|
width: 258, |
||||
|
height: 400, |
||||
|
tools: [{ |
||||
|
id:'gear', |
||||
|
handler: function(){ |
||||
|
Ext.Msg.alert('Message', 'The Settings tool was clicked.'); |
||||
|
} |
||||
|
},{ |
||||
|
id:'close', |
||||
|
handler: function(e, target, panel){ |
||||
|
panel.ownerCt.remove(panel, true); |
||||
|
} |
||||
|
}], |
||||
|
frame: true, |
||||
|
bodyStyle: 'padding: 0px;', |
||||
|
plr: null, |
||||
|
title: '%%%NODENAME%%%', |
||||
|
items:[{ |
||||
|
html: '<video id="hls-%%%NODEID%%%" class="video-js vjs-default-skin" width="244" height="200"></video>', |
||||
|
},{ |
||||
|
xtype: 'spacer', |
||||
|
height: 5 |
||||
|
},{ |
||||
|
xtype: 'combo', |
||||
|
id: 'src_combo_%%%NODEID%%%', |
||||
|
typeAhead: false, |
||||
|
width: 244, |
||||
|
triggerAction: 'all', |
||||
|
listEmptyText: 'No Video Sources', |
||||
|
lazyRender:true, |
||||
|
mode: 'local', |
||||
|
%%%SELID%%% |
||||
|
listeners:{ |
||||
|
'select': function( t, r, i ){ |
||||
|
var p = Ext.getCmp('db_node_%%%NODEID%%%'); |
||||
|
if( p != null ){ |
||||
|
if( p.plr!= null ){ |
||||
|
p.plr.src({type: 'application/x-mpegURL', src: r.data.src }); |
||||
|
}; |
||||
|
}; |
||||
|
} |
||||
|
}, |
||||
|
store: new Ext.data.ArrayStore({ |
||||
|
id: 0, |
||||
|
fields: [ |
||||
|
'id', |
||||
|
'label', |
||||
|
'src' |
||||
|
], |
||||
|
data: %%%URLS%%% |
||||
|
}), |
||||
|
valueField: 'id', |
||||
|
displayField: 'label' |
||||
|
},{ |
||||
|
xtype: 'spacer', |
||||
|
height: 5 |
||||
|
},{ |
||||
|
xtype: 'button', |
||||
|
text: 'PTZ Control', |
||||
|
width: 244, |
||||
|
handler: function(){ |
||||
|
alert("ptz "); |
||||
|
} |
||||
|
}], |
||||
|
listeners:{ |
||||
|
afterrender: function( t ){ |
||||
|
t.plr = videojs.getPlayer('hls-%%%NODEID%%%'); |
||||
|
if( t.plr == null ){ |
||||
|
t.plr = videojs('hls-%%%NODEID%%%',{ |
||||
|
autoplay: 'muted', |
||||
|
controls: true, |
||||
|
controlBar: { |
||||
|
volumePanel: false, |
||||
|
playToggle: false, |
||||
|
pictureInPictureToggle: false |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
t.plr.src({type: 'application/x-mpegURL', src: '%%%SELURL%%%'}); |
||||
|
return true; |
||||
|
}, |
||||
|
destroy: function( t ){ |
||||
|
if( t.plr != null ) t.plr.dispose(); |
||||
|
t.plr = null; |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
{ |
||||
|
id: 'db_node_%%%NODEID%%%', |
||||
|
xtype: 'panel', |
||||
|
width: 400, |
||||
|
height: 400, |
||||
|
frame: true, |
||||
|
title: 'Camera %%%NODEID%%%', |
||||
|
items:[{ |
||||
|
html: '<video id="hls-example" class="video-js vjs-default-skin" width="400" height="300"><source type="application/x-mpegURL" src="http://192.168.0.116:8081/d7d823703f68ba05c04efdb7474c2de5/7/hls.m3u8"></video>', |
||||
|
}], |
||||
|
listeners:{ |
||||
|
afterrender: function(){ |
||||
|
var player = videojs('hls-example',{ |
||||
|
autoplay: 'muted' |
||||
|
}); |
||||
|
return true; |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
@ -1,7 +1,8 @@ |
|||||
{ |
{ |
||||
id: 'db_node_%%%NODEID%%%', |
id: 'db_node_%%%NODEID%%%', |
||||
width: 800, |
|
||||
height: 200, |
|
||||
|
width: 258, |
||||
|
height: 200, |
||||
|
title: '3D Lidar', |
||||
items:[{ |
items:[{ |
||||
html: '3D Lidar' |
html: '3D Lidar' |
||||
}] |
}] |
||||
@ -1,14 +1,16 @@ |
|||||
{ |
|
||||
title: 'System Dashboard', |
|
||||
bodyStyle: 'padding:15px', |
|
||||
layout: 'auto', |
|
||||
//width: 400,
|
|
||||
//height: 400,
|
|
||||
defaults: { |
|
||||
// applied to each contained panel
|
|
||||
bodyStyle: 'padding:15px;border-radius: 20px;background-color: ivory; text-color: black;', |
|
||||
}, |
|
||||
items:[ |
|
||||
%%%ITEMS%%% |
|
||||
] |
|
||||
} |
|
||||
|
[{ |
||||
|
columnWidth: '320px', |
||||
|
style:'padding:10px 0 10px 10px', |
||||
|
items:[ |
||||
|
%%%ITEMS%%% |
||||
|
] |
||||
|
},{ |
||||
|
columnWidth: '320px', |
||||
|
style:'padding:10px 0 10px 10px' |
||||
|
},{ |
||||
|
columnWidth: '320px', |
||||
|
style:'padding:10px 0 10px 10px' |
||||
|
},{ |
||||
|
columnWidth: '320px', |
||||
|
style:'padding:10px 0 10px 10px' |
||||
|
}] |
||||
@ -1,38 +1,75 @@ |
|||||
<?php |
|
||||
require_once('../ajax_asm.php'); |
|
||||
if( $CUser->Data['id'] > 1 ){ |
|
||||
$SiteID = intval( $_POST['SITE'] ); |
|
||||
$QS = "SELECT * FROM nodes WHERE site_id = {$SiteID}"; |
|
||||
$result = $DATABASE->Query( $QS, false ); |
|
||||
$Data = file_get_contents( 'dash/tpl.js' ); |
|
||||
if( count( $result ) > 0 ){ |
|
||||
$index = 0; |
|
||||
$TPL = array(); |
|
||||
foreach( $result as $R ){ |
|
||||
$TPL[$index] = file_get_contents( 'dash/node_' . $R['type'] . '.js' ); |
|
||||
$TPL[$index] = str_replace('%%%NODEID%%%', ''.$R['id'] , $TPL[$index] ); |
|
||||
switch( $R['type'] ){ |
|
||||
case ARGUS_SERVER:{ |
|
||||
break; |
|
||||
}; |
|
||||
case ARGUS_3D_SENSOR:{ |
|
||||
break; |
|
||||
}; |
|
||||
case ARGUS_IP_PTZ_CAMERA:{ |
|
||||
break; |
|
||||
}; |
|
||||
}; |
|
||||
$index++; |
|
||||
}; |
|
||||
$ITEMS = implode( ',', $TPL ); |
|
||||
$Data = str_replace('%%%ITEMS%%%', ''.$ITEMS , $Data ); |
|
||||
}; |
|
||||
if( $Data != '' ) { |
|
||||
echo $Data; |
|
||||
} else { |
|
||||
echo '{}'; |
|
||||
}; |
|
||||
exit(); |
|
||||
}; |
|
||||
echo "{}"; |
|
||||
|
<?php |
||||
|
require_once('../ajax_asm.php'); |
||||
|
if( $CUser->Data['id'] > 1 ){ |
||||
|
$SiteID = intval( $_POST['SITE'] ); |
||||
|
$QS = "SELECT * FROM nodes WHERE site_id = {$SiteID}"; |
||||
|
$result = $DATABASE->Query( $QS, false ); |
||||
|
$Data = file_get_contents( 'dash/tpl.js' ); |
||||
|
if( count( $result ) > 0 ){ |
||||
|
$index = 0; |
||||
|
$TPL = array(); |
||||
|
foreach( $result as $R ){ |
||||
|
$TFN = 'dash/node_' . $R['type'] . '.js'; |
||||
|
if(!file_exists( $TFN )) continue; |
||||
|
$TPL[$index] = file_get_contents( $TFN ); |
||||
|
$TPL[$index] = str_replace('%%%NODEID%%%', ''.$R['id'] , $TPL[$index] ); |
||||
|
switch( $R['type'] ){ |
||||
|
case ARGUS_SERVER:{ |
||||
|
break; |
||||
|
}; |
||||
|
case ARGUS_3D_SENSOR:{ |
||||
|
break; |
||||
|
}; |
||||
|
case ARGUS_IP_PTZ_CAMERA:{ |
||||
|
$QS="SELECT * FROM cameras WHERE node_id={$R['id']}"; |
||||
|
$Z=$DATABASE->Query( $QS ); |
||||
|
$QS="SELECT mss.*, ms.name, ms.img_width, ms.img_height FROM media_server_streams mss LEFT JOIN media_streams ms ON ( mss.media_stream_id = ms.id ) WHERE ms.source_id={$Z[0]['id']} AND mss.valid=1 AND mss.online=1"; |
||||
|
$S=$DATABASE->Query( $QS ); |
||||
|
$TPL[$index] = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL[$index] ); |
||||
|
if( count( $S ) ){ |
||||
|
$CS = array(); |
||||
|
$FID = 0; |
||||
|
$FUL = ''; |
||||
|
foreach( $S as $sou ){ |
||||
|
$QS = "SELECT * FROM media_servers WHERE id = {$sou['media_server_id']}"; |
||||
|
$F = $DATABASE->Query( $QS ); |
||||
|
$FF=$F[0]; |
||||
|
if( $FF['ip']=='127.0.0.1'){ |
||||
|
//Localhost
|
||||
|
$FF['ip'] = $_SERVER['SERVER_ADDR']; |
||||
|
}; |
||||
|
$ACC_URL='http://' . $FF['ip'] . ':' . $FF['REST_port']; |
||||
|
$CU = str_replace( $FF['virtual_host'], $ACC_URL, $sou['key'] ) . '/hls.m3u8'; |
||||
|
if( $FID == 0 ){ |
||||
|
// First URL as default
|
||||
|
$FID = $sou['id']; |
||||
|
$FUL = $CU; |
||||
|
}; |
||||
|
$CS[] = '[' . $sou['id'] . ',\'[' . $sou['img_width'] . 'x' . $sou['img_height'] . '] '. $sou['name'].'\',\'' . $CU .'\']'; |
||||
|
}; |
||||
|
$TPL[$index] = str_replace( '%%%URLS%%%', '['. implode( ',', $CS ) . ']' , $TPL[$index] ); |
||||
|
$TPL[$index] = str_replace( '%%%SELID%%%', 'value: '. $FID .',', $TPL[$index] ); |
||||
|
$TPL[$index] = str_replace( '%%%SELURL%%%', $FUL, $TPL[$index] ); |
||||
|
} else { |
||||
|
// Handle No Video From Camera!
|
||||
|
$TPL[$index] = str_replace( '%%%URLS%%%', '[]' , $TPL[$index] ); |
||||
|
$TPL[$index] = str_replace( '%%%SELID%%%', 'value: \'No Video Sources\',', $TPL[$index] ); |
||||
|
$TPL[$index] = str_replace( '%%%SELURL%%%','', $TPL[$index] ); |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
}; |
||||
|
$index++; |
||||
|
}; |
||||
|
$ITEMS = implode( ',', $TPL ); |
||||
|
$Data = str_replace('%%%ITEMS%%%', ''.$ITEMS , $Data ); |
||||
|
}; |
||||
|
if( $Data != '' ) { |
||||
|
echo $Data; |
||||
|
} else { |
||||
|
echo '{}'; |
||||
|
}; |
||||
|
exit(); |
||||
|
}; |
||||
|
echo "{}"; |
||||
?>
|
?>
|
||||
@ -1,202 +1,261 @@ |
|||||
var netwodkData = { |
|
||||
edges: null, |
|
||||
nodes: null |
|
||||
}; |
|
||||
|
|
||||
var selectedConnection = null; |
|
||||
var selectedNode = null; |
|
||||
var selected_A_socket = null; |
|
||||
var selected_B_socket = null; |
|
||||
var addConnectionDialog = null; |
|
||||
var networkObj = null; |
|
||||
|
|
||||
var ARGUS_SERVER = 0; |
|
||||
var ARGUS_ALS_SENSOR = 1; |
|
||||
var ARGUS_LFS_SENSOR = 2; |
|
||||
var ARGUS_PLS_200_SENSOR = 3; |
|
||||
var ARGUS_PLS_360_SENSOR = 4; |
|
||||
var ARGUS_3D_SENSOR = 5; |
|
||||
var ARGUS_NET_PLS_200 = 6; |
|
||||
var ARGUS_ANALOG_STATIC_CAMERA = 10; |
|
||||
var ARGUS_ANALOG_PTZ_CAMERA = 11; |
|
||||
var ARGUS_IP_STATIC_CAMERA = 12; |
|
||||
var ARGUS_IP_PTZ_CAMERA = 13; |
|
||||
var ARGUS_IP_UART_GATEWAY = 20; |
|
||||
var ARGUS_JAMER = 40; |
|
||||
var ARGUS_IP_VIDEO_SERVER = 50; |
|
||||
var ARGUS_DRONE_CONTROL = 60; |
|
||||
var ARGUS_UNKNOWN = 255; |
|
||||
|
|
||||
var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_CTRL_SLAVE = 1; |
|
||||
var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_CTRL_MASTER = 2; |
|
||||
var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_PTZ = 3; |
|
||||
var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_SERVER = 4; |
|
||||
var ARGUS_NODE_SOCK_TYPE_NETWORK_DEVICE = 5; |
|
||||
var ARGUS_NODE_SOCK_TYPE_NETWORK_SERVER = 6; |
|
||||
var ARGUS_NODE_SOCK_TYPE_NETWORK_SENDER = 7; |
|
||||
var ARGUS_NODE_SOCK_TYPE_NETWORK_VIDEO = 8; |
|
||||
var ARGUS_NODE_SOCK_TYPE_DC = 9; |
|
||||
var ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER = 10; |
|
||||
var ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER = 11; |
|
||||
|
|
||||
function sockTypeRenderer( r ){ |
|
||||
switch( r ){ |
|
||||
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_CTRL_SLAVE: return 'UART'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_CTRL_MASTER: return 'UART'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_PTZ: return 'UART'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_SERVER: return 'UART'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_NETWORK_DEVICE: return 'NET'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_NETWORK_SERVER: return 'NET'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_NETWORK_SENDER: return 'NET'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_NETWORK_VIDEO: return 'NET'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_DC: return 'DC'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER: return 'A-Video'; |
|
||||
case ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER: return 'A-Audio'; |
|
||||
default: return 'Undefined'; |
|
||||
}; |
|
||||
}; |
|
||||
|
|
||||
var A_socketsListStore = new Ext.data.JsonStore({ |
|
||||
root: 'nodes', |
|
||||
totalProperty: 'totalCount', |
|
||||
idProperty: 'id', |
|
||||
remoteSort: true, |
|
||||
fields: [{ |
|
||||
name: 'id', |
|
||||
type: 'int' |
|
||||
},{ |
|
||||
name: 'name', |
|
||||
type: 'string' |
|
||||
},{ |
|
||||
name: 'mode', |
|
||||
type: 'int' |
|
||||
},{ |
|
||||
name: 'type', |
|
||||
type: 'int' |
|
||||
},{ |
|
||||
name: 'binded', |
|
||||
type: 'int' |
|
||||
}] |
|
||||
}); |
|
||||
|
|
||||
var A_socketSelModel = new Ext.grid.RowSelectionModel({ |
|
||||
singleSelect: true, |
|
||||
listeners: { |
|
||||
rowselect: function( sm, row, rec ) { |
|
||||
selected_A_socket = rec.data; |
|
||||
if( selected_B_socket != null ){ |
|
||||
if( selected_A_socket.type == selected_B_socket.type ){ |
|
||||
if( |
|
||||
( selected_A_socket.mode == ARGUS_NODE_SOCK_TYPE_NETWORK ) || |
|
||||
( selected_B_socket.mode == ARGUS_NODE_SOCK_TYPE_NETWORK ) || |
|
||||
( selected_B_socket.mode != selected_A_socket.mode ) |
|
||||
){ |
|
||||
Ext.getCmp('con_to_src').enable(); |
|
||||
}; |
|
||||
} else { |
|
||||
Ext.getCmp('con_to_src').disable(); |
|
||||
}; |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
var B_socketsListStore = new Ext.data.JsonStore({ |
|
||||
root: 'nodes', |
|
||||
totalProperty: 'totalCount', |
|
||||
idProperty: 'id', |
|
||||
remoteSort: true, |
|
||||
fields: [{ |
|
||||
name: 'id', |
|
||||
type: 'int' |
|
||||
},{ |
|
||||
name: 'name', |
|
||||
type: 'string' |
|
||||
},{ |
|
||||
name: 'mode', |
|
||||
type: 'int' |
|
||||
},{ |
|
||||
name: 'type', |
|
||||
type: 'int' |
|
||||
},{ |
|
||||
name: 'binded', |
|
||||
type: 'int' |
|
||||
}] |
|
||||
}); |
|
||||
|
|
||||
var B_socketSelModel = new Ext.grid.RowSelectionModel({ |
|
||||
singleSelect: true, |
|
||||
listeners: { |
|
||||
rowselect: function( sm, row, rec ) { |
|
||||
selected_B_socket = rec.data; |
|
||||
if( selected_A_socket != null ){ |
|
||||
if( selected_A_socket.type == selected_B_socket.type ){ |
|
||||
if( |
|
||||
( selected_A_socket.mode == ARGUS_NODE_SOCK_TYPE_NETWORK ) || |
|
||||
( selected_B_socket.mode == ARGUS_NODE_SOCK_TYPE_NETWORK ) || |
|
||||
( selected_B_socket.mode != selected_A_socket.mode ) |
|
||||
){ |
|
||||
Ext.getCmp('con_to_src').enable(); |
|
||||
}; |
|
||||
} else { |
|
||||
Ext.getCmp('con_to_src').disable(); |
|
||||
}; |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
var socketListColModel = new Ext.grid.ColumnModel({ |
|
||||
columns: [ |
|
||||
{header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, |
|
||||
{header: "", width: 30, dataIndex: 'binded' }, |
|
||||
{header: "", width: 30, dataIndex: 'mode' }, |
|
||||
{header: "Type",width: 100, sortable: false, fixed: true, renderer: sockTypeRenderer, dataIndex: 'type' }, |
|
||||
{header: "Name",width: 150, dataIndex: 'name' } |
|
||||
], |
|
||||
defaults: { |
|
||||
sortable: false, |
|
||||
menuDisabled: true |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
|
|
||||
var networkOpts = { |
|
||||
interaction:{ |
|
||||
hover: true |
|
||||
}, |
|
||||
manipulation: { |
|
||||
enabled: false, |
|
||||
addNode: function (data, callback) { |
|
||||
// filling in the popup DOM elements
|
|
||||
//console.log('add', data);
|
|
||||
}, |
|
||||
editNode: function (data, callback) { |
|
||||
// filling in the popup DOM elements
|
|
||||
//console.log('edit', data);
|
|
||||
}, |
|
||||
addEdge: function (data, callback) { |
|
||||
//console.log('add edge', data);
|
|
||||
if (data.from == data.to) { |
|
||||
var r = confirm("Do you want to connect the node to itself?"); |
|
||||
if (r === true) { |
|
||||
createConnection( data.from, data.to ); |
|
||||
}; |
|
||||
} else { |
|
||||
createConnection( data.from, data.to ); |
|
||||
}; |
|
||||
networkObj.disableEditMode(); |
|
||||
} |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
function startCreateConnection(){ |
|
||||
if( networkObj!= null ){ |
|
||||
networkObj.addEdgeMode(); |
|
||||
}; |
|
||||
}; |
|
||||
|
|
||||
function loadLinkProperties( EdgeID, From, To ){ |
|
||||
alert( 'Edge: ' + EdgeID ); |
|
||||
}; |
|
||||
|
|
||||
|
var netwodkData = { |
||||
|
edges: null, |
||||
|
nodes: null |
||||
|
}; |
||||
|
|
||||
|
var selectedConnection = null; |
||||
|
var selectedNode = null; |
||||
|
var selected_A_socket = null; |
||||
|
var selected_B_socket = null; |
||||
|
var addConnectionDialog = null; |
||||
|
var networkObj = null; |
||||
|
|
||||
|
var ARGUS_SERVER = 0; |
||||
|
var ARGUS_ALS_SENSOR = 1; |
||||
|
var ARGUS_LFS_SENSOR = 2; |
||||
|
var ARGUS_PLS_200_SENSOR = 3; |
||||
|
var ARGUS_PLS_360_SENSOR = 4; |
||||
|
var ARGUS_3D_SENSOR = 5; |
||||
|
var ARGUS_NET_PLS_200 = 6; |
||||
|
var ARGUS_ANALOG_STATIC_CAMERA = 10; |
||||
|
var ARGUS_ANALOG_PTZ_CAMERA = 11; |
||||
|
var ARGUS_IP_STATIC_CAMERA = 12; |
||||
|
var ARGUS_IP_PTZ_CAMERA = 13; |
||||
|
var ARGUS_IP_UART_GATEWAY = 20; |
||||
|
var ARGUS_JAMER = 40; |
||||
|
var ARGUS_IP_VIDEO_SERVER = 50; |
||||
|
var ARGUS_DRONE_CONTROL = 60; |
||||
|
var ARGUS_UNKNOWN = 255; |
||||
|
|
||||
|
var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT = 1; |
||||
|
var ARGUS_NODE_SOCK_TYPE_NET4 = 2; |
||||
|
var ARGUS_NODE_SOCK_TYPE_DC = 3; |
||||
|
var ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER = 4; |
||||
|
var ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER = 5; |
||||
|
var ARGUS_NODE_SOCK_TYPE_IPV = 6; |
||||
|
var ARGUS_NODE_SOCK_TYPE_DVR = 7; |
||||
|
var ARGUS_NODE_SOCK_TYPE_NET6 = 8; |
||||
|
|
||||
|
function sockTypeRenderer( r ){ |
||||
|
switch( r ){ |
||||
|
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT: return 'UART'; |
||||
|
case ARGUS_NODE_SOCK_TYPE_NET4: return 'NET4'; |
||||
|
case ARGUS_NODE_SOCK_TYPE_NET6: return 'NET6'; |
||||
|
case ARGUS_NODE_SOCK_TYPE_DC: return 'DC'; |
||||
|
case ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER: return 'A-V'; |
||||
|
case ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER: return 'A-A'; |
||||
|
case ARGUS_NODE_SOCK_TYPE_IPV: return 'IPV'; |
||||
|
case ARGUS_NODE_SOCK_TYPE_DVR: return 'DVR'; |
||||
|
default: return 'TBD'; |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
function sockModeRenderer( r ){ |
||||
|
switch( r ){ |
||||
|
case 1: return 'IN'; |
||||
|
case 2: return 'OUT'; |
||||
|
case 3: return 'IN/OUT'; |
||||
|
default: return 'TBD'; |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
var A_socketsListStore = new Ext.data.JsonStore({ |
||||
|
root: 'nodes', |
||||
|
totalProperty: 'totalCount', |
||||
|
idProperty: 'id', |
||||
|
remoteSort: true, |
||||
|
fields: [{ |
||||
|
name: 'id', |
||||
|
type: 'int' |
||||
|
},{ |
||||
|
name: 'name', |
||||
|
type: 'string' |
||||
|
},{ |
||||
|
name: 'mode', |
||||
|
type: 'int' |
||||
|
},{ |
||||
|
name: 'type', |
||||
|
type: 'int' |
||||
|
},{ |
||||
|
name: 'binded', |
||||
|
type: 'int' |
||||
|
}] |
||||
|
}); |
||||
|
|
||||
|
var A_socketSelModel = new Ext.grid.RowSelectionModel({ |
||||
|
singleSelect: true, |
||||
|
listeners: { |
||||
|
rowselect: function( sm, row, rec ) { |
||||
|
selected_A_socket = rec.data; |
||||
|
if( selected_B_socket != null ){ |
||||
|
switch( selected_A_socket.type ){ |
||||
|
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT:{ |
||||
|
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_SERIAL_PORT ){ |
||||
|
if( ( selected_A_socket.mode == 1 && selected_B_socket.mode == 2 ) || ( selected_A_socket.mode == 3 || selected_B_socket.mode == 3 ) || ( selected_A_socket.mode == 2 && selected_B_socket.mode == 1 )) { |
||||
|
Ext.getCmp('con_to_src').enable(); |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
case ARGUS_NODE_SOCK_TYPE_NET4:{ |
||||
|
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_NET4 ){ |
||||
|
Ext.getCmp('con_to_src').enable(); |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
case ARGUS_NODE_SOCK_TYPE_IPV:{ |
||||
|
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_DVR ){ |
||||
|
Ext.getCmp('con_to_src').enable(); |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
case ARGUS_NODE_SOCK_TYPE_DVR:{ |
||||
|
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_IPV ){ |
||||
|
Ext.getCmp('con_to_src').enable(); |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
default: Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
var B_socketsListStore = new Ext.data.JsonStore({ |
||||
|
root: 'nodes', |
||||
|
totalProperty: 'totalCount', |
||||
|
idProperty: 'id', |
||||
|
remoteSort: true, |
||||
|
fields: [{ |
||||
|
name: 'id', |
||||
|
type: 'int' |
||||
|
},{ |
||||
|
name: 'name', |
||||
|
type: 'string' |
||||
|
},{ |
||||
|
name: 'mode', |
||||
|
type: 'int' |
||||
|
},{ |
||||
|
name: 'type', |
||||
|
type: 'int' |
||||
|
},{ |
||||
|
name: 'binded', |
||||
|
type: 'int' |
||||
|
}] |
||||
|
}); |
||||
|
|
||||
|
var B_socketSelModel = new Ext.grid.RowSelectionModel({ |
||||
|
singleSelect: true, |
||||
|
listeners: { |
||||
|
rowselect: function( sm, row, rec ) { |
||||
|
selected_B_socket = rec.data; |
||||
|
if( selected_A_socket != null ){ |
||||
|
switch( selected_A_socket.type ){ |
||||
|
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT:{ |
||||
|
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_SERIAL_PORT ){ |
||||
|
if( ( selected_A_socket.mode == 1 && selected_B_socket.mode == 2 ) || ( selected_A_socket.mode == 3 || selected_B_socket.mode == 3 ) || ( selected_A_socket.mode == 2 && selected_B_socket.mode == 1 )) { |
||||
|
Ext.getCmp('con_to_src').enable(); |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
case ARGUS_NODE_SOCK_TYPE_NET4:{ |
||||
|
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_NET4 ){ |
||||
|
Ext.getCmp('con_to_src').enable(); |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
case ARGUS_NODE_SOCK_TYPE_IPV:{ |
||||
|
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_DVR ){ |
||||
|
Ext.getCmp('con_to_src').enable(); |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
case ARGUS_NODE_SOCK_TYPE_DVR:{ |
||||
|
if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_IPV ){ |
||||
|
Ext.getCmp('con_to_src').enable(); |
||||
|
} else { |
||||
|
Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
default: Ext.getCmp('con_to_src').disable(); |
||||
|
}; |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
var socketListColModel = new Ext.grid.ColumnModel({ |
||||
|
columns: [ |
||||
|
{header: "id", width: 30, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, |
||||
|
{header: "", width: 30, dataIndex: 'binded' }, |
||||
|
{header: "", width: 70, renderer: sockModeRenderer, dataIndex: 'mode' }, |
||||
|
{header: "Type",width: 50, sortable: false, fixed: true, renderer: sockTypeRenderer, dataIndex: 'type' }, |
||||
|
{header: "Name",width: 185, dataIndex: 'name' } |
||||
|
], |
||||
|
defaults: { |
||||
|
sortable: false, |
||||
|
menuDisabled: true |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
var networkOpts = { |
||||
|
interaction:{ |
||||
|
hover: true |
||||
|
}, |
||||
|
manipulation: { |
||||
|
enabled: false, |
||||
|
addNode: function (data, callback) { |
||||
|
// filling in the popup DOM elements
|
||||
|
//console.log('add', data);
|
||||
|
}, |
||||
|
editNode: function (data, callback) { |
||||
|
// filling in the popup DOM elements
|
||||
|
//console.log('edit', data);
|
||||
|
}, |
||||
|
addEdge: function (data, callback) { |
||||
|
//console.log('add edge', data);
|
||||
|
if (data.from == data.to) { |
||||
|
var r = confirm("Do you want to connect the node to itself?"); |
||||
|
if (r === true) { |
||||
|
createConnection( data.from, data.to ); |
||||
|
}; |
||||
|
} else { |
||||
|
createConnection( data.from, data.to ); |
||||
|
}; |
||||
|
networkObj.disableEditMode(); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
function startCreateConnection(){ |
||||
|
if( networkObj!= null ){ |
||||
|
networkObj.addEdgeMode(); |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
function loadLinkProperties( EdgeID, From, To ){ |
||||
|
alert( 'Edge: ' + EdgeID ); |
||||
|
}; |
||||
|
|
||||
@ -1,114 +1,114 @@ |
|||||
<?php |
|
||||
|
|
||||
define ("ADD_ENCODER_SOURCE_IDX", 0); |
|
||||
define ("ADD_STREAM_PROXY_IDX", 1); |
|
||||
define ("CLOSE_STREAM_IDX", 2); |
|
||||
define ("DEL_ENCODER_SOURCE_IDX", 3); |
|
||||
define ("DEL_STREAM_PROXY_IDX", 4); |
|
||||
define ("LIST_SESSIONS_IDX", 5); |
|
||||
define ("LIST_API_IDX", 6); |
|
||||
define ("LIST_MEDIA_IDX", 7); |
|
||||
define ("GET_SERVER_CONFIG_IDX", 8); |
|
||||
define ("GET_LOAD_STATS_IDX", 9); |
|
||||
define ("GET_WORK_LOAD_STATS_IDX", 10); |
|
||||
define ("KICK_SESSION_IDX", 11); |
|
||||
define ("RESTART_SERVER_IDX", 12); |
|
||||
define ("SET_SERVER_CONFIG_IDX", 13); |
|
||||
define ("FETCH_STREAM_TCP", 0); |
|
||||
define ("FETCH_STREAM_UDP", 1); |
|
||||
define ("FETCH_STREAM_MULTICAST", 2); |
|
||||
define ("ZL_DEFAULT_VHOST", '__defaultVhost__'); |
|
||||
|
|
||||
class zlMediaServer{ |
|
||||
var $_secret = ''; |
|
||||
var $_addressREST = ''; |
|
||||
var $_addressPort = 8081; |
|
||||
var $_accessURL = array(); |
|
||||
function __construct($Secret){ |
|
||||
$this->_secret = $Secret; |
|
||||
$this->_addressREST = '127.0.0.1'; |
|
||||
$this->_accessURL[] = "/index/api/addFFmpegSource"; |
|
||||
$this->_accessURL[] = "/index/api/addStreamProxy"; |
|
||||
$this->_accessURL[] = "/index/api/close_stream"; |
|
||||
$this->_accessURL[] = "/index/api/delFFmepgSource"; |
|
||||
$this->_accessURL[] = "/index/api/delStreamProxy"; |
|
||||
$this->_accessURL[] = "/index/api/getAllSession"; |
|
||||
$this->_accessURL[] = "/index/api/getApiList"; |
|
||||
$this->_accessURL[] = "/index/api/getMediaList"; |
|
||||
$this->_accessURL[] = "/index/api/getServerConfig"; |
|
||||
$this->_accessURL[] = "/index/api/getThreadsLoad"; |
|
||||
$this->_accessURL[] = "/index/api/getWorkThreadsLoad"; |
|
||||
$this->_accessURL[] = "/index/api/kick_session"; |
|
||||
$this->_accessURL[] = "/index/api/restartServer"; |
|
||||
$this->_accessURL[] = "/index/api/setServerConfig"; |
|
||||
} |
|
||||
function __destruct(){ |
|
||||
} |
|
||||
public function setAccessPointREST( $address ){ |
|
||||
$this->_addressREST = $address; |
|
||||
} |
|
||||
private function composeURL( $idx ){ |
|
||||
return "http://" . $this->_addressREST . ':' . $this->_addressPort . $this->_accessURL[$idx] . '?secret=' . $this->_secret; |
|
||||
} |
|
||||
public function getServerConfig(){ |
|
||||
$pack['secret'] = $this->_secret; |
|
||||
$ch = curl_init(); |
|
||||
curl_setopt( $ch, CURLOPT_URL, $this->composeURL( GET_SERVER_CONFIG_IDX ) ); |
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0); |
|
||||
curl_setopt( $ch, CURLOPT_POST, 1); |
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); |
|
||||
$output = curl_exec( $ch ); |
|
||||
curl_close( $ch ); |
|
||||
$AN = json_decode( $output ); |
|
||||
echo "Returned Transfer: " . $output ."\n\n"; |
|
||||
} |
|
||||
public function addStreamProxy( $src, $appname, $rtsp_ena = 0, $rtmp_ena = 0, $hls_ena = 1, $recode_ena = 0, $rtp_type = FETCH_STREAM_TCP, $vhost=ZL_DEFAULT_VHOST ){ |
|
||||
$pack['secret'] = $this->_secret; |
|
||||
$Params = '&vhost=' . urlencode( $vhost ) . '&app=' . urlencode( $appname ) . '&stream=0&url=' . $src . '&enable_rtsp=' . $rtsp_ena . '&enable_rtmp=' . $rtmp_ena . '&enable_hls=' . $hls_ena . '&enable_mp4=' . $recode_ena . '&rtp_type=' . $rtp_type; |
|
||||
$ch = curl_init(); |
|
||||
curl_setopt( $ch, CURLOPT_URL, $this->composeURL( ADD_STREAM_PROXY_IDX ) . $Params ); |
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0); |
|
||||
curl_setopt( $ch, CURLOPT_POST, 1); |
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); |
|
||||
$output = curl_exec( $ch ); |
|
||||
curl_close( $ch ); |
|
||||
$AN = json_decode( $output ); |
|
||||
print_r( $AN ); |
|
||||
if( $AN->code == 0 ) { |
|
||||
return $AN->data->key; |
|
||||
}; |
|
||||
return ''; |
|
||||
} |
|
||||
public function delStreamProxy( $key ){ |
|
||||
$pack['secret'] = $this->_secret; |
|
||||
$Params = '&key=' . urlencode( $key ); |
|
||||
$ch = curl_init(); |
|
||||
curl_setopt( $ch, CURLOPT_URL, $this->composeURL( ADD_STREAM_PROXY_IDX ) . $Params ); |
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0); |
|
||||
curl_setopt( $ch, CURLOPT_POST, 1); |
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); |
|
||||
$output = curl_exec( $ch ); |
|
||||
curl_close( $ch ); |
|
||||
$AN = json_decode( $output ); |
|
||||
if( $AN['code'] == 0 ){ |
|
||||
return $AN['data']['flag']; |
|
||||
}; |
|
||||
return false; |
|
||||
} |
|
||||
public function listMedia(){ |
|
||||
$pack['secret'] = $this->_secret; |
|
||||
$ch = curl_init(); |
|
||||
curl_setopt( $ch, CURLOPT_URL, $this->composeURL( LIST_MEDIA_IDX ) ); |
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0); |
|
||||
curl_setopt( $ch, CURLOPT_POST, 1); |
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); |
|
||||
$output = curl_exec( $ch ); |
|
||||
curl_close( $ch ); |
|
||||
echo "Returned Transfer: " . $output ."\n\n"; |
|
||||
} |
|
||||
} |
|
||||
|
<?php |
||||
|
|
||||
|
define ("ADD_ENCODER_SOURCE_IDX", 0); |
||||
|
define ("ADD_STREAM_PROXY_IDX", 1); |
||||
|
define ("CLOSE_STREAM_IDX", 2); |
||||
|
define ("DEL_ENCODER_SOURCE_IDX", 3); |
||||
|
define ("DEL_STREAM_PROXY_IDX", 4); |
||||
|
define ("LIST_SESSIONS_IDX", 5); |
||||
|
define ("LIST_API_IDX", 6); |
||||
|
define ("LIST_MEDIA_IDX", 7); |
||||
|
define ("GET_SERVER_CONFIG_IDX", 8); |
||||
|
define ("GET_LOAD_STATS_IDX", 9); |
||||
|
define ("GET_WORK_LOAD_STATS_IDX", 10); |
||||
|
define ("KICK_SESSION_IDX", 11); |
||||
|
define ("RESTART_SERVER_IDX", 12); |
||||
|
define ("SET_SERVER_CONFIG_IDX", 13); |
||||
|
define ("FETCH_STREAM_TCP", 0); |
||||
|
define ("FETCH_STREAM_UDP", 1); |
||||
|
define ("FETCH_STREAM_MULTICAST", 2); |
||||
|
define ("ZL_DEFAULT_VHOST", '__defaultVhost__'); |
||||
|
|
||||
|
class zlMediaServer{ |
||||
|
var $_secret = ''; |
||||
|
var $_addressREST = ''; |
||||
|
var $_addressPort = 8081; |
||||
|
var $_accessURL = array(); |
||||
|
function __construct($Secret){ |
||||
|
$this->_secret = $Secret; |
||||
|
$this->_addressREST = '127.0.0.1'; |
||||
|
$this->_accessURL[] = "/index/api/addFFmpegSource"; |
||||
|
$this->_accessURL[] = "/index/api/addStreamProxy"; |
||||
|
$this->_accessURL[] = "/index/api/close_stream"; |
||||
|
$this->_accessURL[] = "/index/api/delFFmepgSource"; |
||||
|
$this->_accessURL[] = "/index/api/delStreamProxy"; |
||||
|
$this->_accessURL[] = "/index/api/getAllSession"; |
||||
|
$this->_accessURL[] = "/index/api/getApiList"; |
||||
|
$this->_accessURL[] = "/index/api/getMediaList"; |
||||
|
$this->_accessURL[] = "/index/api/getServerConfig"; |
||||
|
$this->_accessURL[] = "/index/api/getThreadsLoad"; |
||||
|
$this->_accessURL[] = "/index/api/getWorkThreadsLoad"; |
||||
|
$this->_accessURL[] = "/index/api/kick_session"; |
||||
|
$this->_accessURL[] = "/index/api/restartServer"; |
||||
|
$this->_accessURL[] = "/index/api/setServerConfig"; |
||||
|
} |
||||
|
function __destruct(){ |
||||
|
} |
||||
|
public function setAccessPointREST( $address ){ |
||||
|
$this->_addressREST = $address; |
||||
|
} |
||||
|
private function composeURL( $idx ){ |
||||
|
return "http://" . $this->_addressREST . ':' . $this->_addressPort . $this->_accessURL[$idx] . '?secret=' . $this->_secret; |
||||
|
} |
||||
|
public function getServerConfig(){ |
||||
|
$pack['secret'] = $this->_secret; |
||||
|
$ch = curl_init(); |
||||
|
curl_setopt( $ch, CURLOPT_URL, $this->composeURL( GET_SERVER_CONFIG_IDX ) ); |
||||
|
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
||||
|
curl_setopt( $ch, CURLOPT_HEADER, 0); |
||||
|
curl_setopt( $ch, CURLOPT_POST, 1); |
||||
|
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); |
||||
|
$output = curl_exec( $ch ); |
||||
|
curl_close( $ch ); |
||||
|
$AN = json_decode( $output ); |
||||
|
echo "Returned Transfer: " . $output ."\n\n"; |
||||
|
} |
||||
|
public function addStreamProxy( $src, $appname, $rtsp_ena = 0, $rtmp_ena = 0, $hls_ena = 1, $recode_ena = 0, $rtp_type = FETCH_STREAM_TCP, $vhost=ZL_DEFAULT_VHOST ){ |
||||
|
$pack['secret'] = $this->_secret; |
||||
|
$Params = '&vhost=' . urlencode( $vhost ) . '&app=' . urlencode( $appname ) . '&stream=0&url=' . $src . '&enable_rtsp=' . $rtsp_ena . '&enable_rtmp=' . $rtmp_ena . '&enable_hls=' . $hls_ena . '&enable_mp4=' . $recode_ena . '&rtp_type=' . $rtp_type; |
||||
|
$ch = curl_init(); |
||||
|
curl_setopt( $ch, CURLOPT_URL, $this->composeURL( ADD_STREAM_PROXY_IDX ) . $Params ); |
||||
|
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
||||
|
curl_setopt( $ch, CURLOPT_HEADER, 0); |
||||
|
curl_setopt( $ch, CURLOPT_POST, 1); |
||||
|
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); |
||||
|
$output = curl_exec( $ch ); |
||||
|
curl_close( $ch ); |
||||
|
$AN = json_decode( $output ); |
||||
|
print_r( $AN ); |
||||
|
if( $AN->code == 0 ) { |
||||
|
return $AN->data->key; |
||||
|
}; |
||||
|
return ''; |
||||
|
} |
||||
|
public function delStreamProxy( $key ){ |
||||
|
$pack['secret'] = $this->_secret; |
||||
|
$Params = '&key=' . urlencode( $key ); |
||||
|
$ch = curl_init(); |
||||
|
curl_setopt( $ch, CURLOPT_URL, $this->composeURL( ADD_STREAM_PROXY_IDX ) . $Params ); |
||||
|
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
||||
|
curl_setopt( $ch, CURLOPT_HEADER, 0); |
||||
|
curl_setopt( $ch, CURLOPT_POST, 1); |
||||
|
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); |
||||
|
$output = curl_exec( $ch ); |
||||
|
curl_close( $ch ); |
||||
|
$AN = json_decode( $output ); |
||||
|
if( $AN['code'] == 0 ){ |
||||
|
return $AN['data']['flag']; |
||||
|
}; |
||||
|
return false; |
||||
|
} |
||||
|
public function listMedia(){ |
||||
|
$pack['secret'] = $this->_secret; |
||||
|
$ch = curl_init(); |
||||
|
curl_setopt( $ch, CURLOPT_URL, $this->composeURL( LIST_MEDIA_IDX ) ); |
||||
|
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
||||
|
curl_setopt( $ch, CURLOPT_HEADER, 0); |
||||
|
curl_setopt( $ch, CURLOPT_POST, 1); |
||||
|
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); |
||||
|
$output = curl_exec( $ch ); |
||||
|
curl_close( $ch ); |
||||
|
echo "Returned Transfer: " . $output ."\n\n"; |
||||
|
} |
||||
|
} |
||||
?>
|
?>
|
||||
|
After Width: 64 | Height: 60 | Size: 11 KiB |
|
After Width: 458 | Height: 675 | Size: 348 KiB |
|
After Width: 816 | Height: 377 | Size: 68 KiB |
|
After Width: 64 | Height: 64 | Size: 9.1 KiB |
|
After Width: 458 | Height: 675 | Size: 348 KiB |
|
After Width: 1920 | Height: 1040 | Size: 61 KiB |
|
After Width: 734 | Height: 684 | Size: 406 KiB |
|
After Width: 685 | Height: 216 | Size: 17 KiB |