mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 17:23:28 +00:00
Added function and editor module for handling the video stream paramethers
This commit is contained in:
73
addons/main/functions/fn_video_init.sqf
Normal file
73
addons/main/functions/fn_video_init.sqf
Normal file
@@ -0,0 +1,73 @@
|
||||
params [
|
||||
["_logic", objNull, [objNull]],
|
||||
["_units", [], [[]]],
|
||||
["_activated", true, [true]]
|
||||
];
|
||||
|
||||
if (isServer) exitWith {
|
||||
armatak_module_mediamtx_video_stream_instance_address = _logic getVariable "armatak_module_mediamtx_video_stream_instance_address";
|
||||
armatak_module_mediamtx_video_stream_instance_port = _logic getVariable "armatak_module_mediamtx_video_stream_instance_port";
|
||||
armatak_module_mediamtx_video_stream_instance_auth_user = _logic getVariable "armatak_module_mediamtx_video_stream_instance_auth_user";
|
||||
armatak_module_mediamtx_video_stream_instance_auth_pass = _logic getVariable "armatak_module_mediamtx_video_stream_instance_auth_pass";
|
||||
|
||||
missionNamespace setVariable ["armatak_mediamtx_video_stream_instance_address", armatak_module_mediamtx_video_stream_instance_address];
|
||||
missionNamespace setVariable ["armatak_mediamtx_video_stream_instance_port", armatak_module_mediamtx_video_stream_instance_port];
|
||||
missionNamespace setVariable ["armatak_mediamtx_video_stream_instance_auth_user", armatak_module_mediamtx_video_stream_instance_auth_user];
|
||||
missionNamespace setVariable ["armatak_mediamtx_video_stream_instance_auth_pass", armatak_module_mediamtx_video_stream_instance_auth_pass];
|
||||
|
||||
_startAction = [
|
||||
"ArmatakStartStream",
|
||||
"Start Video Feed",
|
||||
"",
|
||||
{
|
||||
_uuid = (_this select 0) call armatak_fnc_extract_uuid;
|
||||
|
||||
armatak_mediamtx_video_stream_instance_address = missionNamespace getVariable "armatak_mediamtx_video_stream_instance_address";
|
||||
armatak_mediamtx_video_stream_instance_port = missionNamespace getVariable "armatak_mediamtx_video_stream_instance_port";
|
||||
armatak_mediamtx_video_stream_instance_auth_user = missionNamespace getVariable "armatak_mediamtx_video_stream_instance_auth_user";
|
||||
armatak_mediamtx_video_stream_instance_auth_pass = missionNamespace getVariable "armatak_mediamtx_video_stream_instance_auth_pass";
|
||||
|
||||
"armatak" callExtension ["video_stream:start", [armatak_mediamtx_video_stream_instance_address, armatak_mediamtx_video_stream_instance_port, _uuid, armatak_mediamtx_video_stream_instance_auth_user, armatak_mediamtx_video_stream_instance_auth_pass]];
|
||||
(_this select 0) setVariable ["armatak_video_feed_is_streaming", true];
|
||||
},
|
||||
{
|
||||
(_this select 0) getVariable "armatak_video_feed_is_streaming" == false
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[
|
||||
"Man",
|
||||
1,
|
||||
["ACE_SelfActions"],
|
||||
_startAction,
|
||||
true
|
||||
] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
_stopAction = [
|
||||
"ArmatakStopStream",
|
||||
"Stop Video Feed",
|
||||
"",
|
||||
{
|
||||
"armatak" callExtension ["video_stream:stop", []];
|
||||
(_this select 0) setVariable ["armatak_video_feed_is_streaming", false];
|
||||
},
|
||||
{
|
||||
(_this select 0) getVariable "armatak_video_feed_is_streaming"
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[
|
||||
"Man",
|
||||
1,
|
||||
["ACE_SelfActions"],
|
||||
_stopAction,
|
||||
true
|
||||
] call ace_interact_menu_fnc_addActionToClass;
|
||||
if (isMultiplayer) then {
|
||||
{
|
||||
_x setVariable ["armatak_video_feed_is_streaming", false];
|
||||
} forEach playableUnits;
|
||||
} else {
|
||||
player setVariable ["armatak_video_feed_is_streaming", false];
|
||||
};
|
||||
};
|
||||
|
||||
true;
|
||||
Reference in New Issue
Block a user