{"name":"BIS_fnc_playVideo","operator":null,"title":"BIS fnc playVideo","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_playVideo","revid":351834,"updated":"2024-01-13T09:28:32Z","groups":["GUI"],"status":"ok","replaced_by":[],"games":[{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.56"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.56"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":"local","server_exec":false},"exec":null,"description":"Plays in-game video with a range of options. The function can be called or spawned. If spawned, scriptDone command can be used to see if video is stopped or finished. If called in scheduled environment, the next line of code will not process until the video is stopped or finished.\n\nThe function also calls `\"BIS_fnc_playVideo_started\"` and `\"BIS_fnc_playVideo_stopped\"` Scripted Event Handlers in missionNamespace - see BIS_fnc_addScriptedEventHandler and Arma 3: Scripted Event Handlers.\n\n> [!NOTE]\n> - to play the video on an object, e.g an in-game screen, see #Example 3\n> - the video can be stopped in a variety of ways - see #Example 4\n> - see OGV File Format for format and conversion information.","syntaxes":[{"syntax":"[content, size, color, skipVarName, bgColor, keepAspect] spawn BIS_fnc_playVideo","since":null,"effect":null,"exec":null,"params":[{"name":"content","type":"String","optional":false,"default":null,"description":"full path to `.ogv` file","types":["String"],"since":null,"text":"content: String - full path to `.ogv` file"},{"name":"size","type":"Array of Numbers","optional":true,"default":"[safeZoneX, safeZoneY, safeZoneW, safeZoneH]","description":"screen size in format [x, y, w, h]\n\n> [!NOTE]\n> If the aspect ratio of the size parameter is not the same as the aspect ratio of the video file, black bars will be visibile. The video will not be stretched","types":["Array","Number"],"since":null,"text":"size: Array of Numbers - (Optional, default [safeZoneX, safeZoneY, safeZoneW, safeZoneH]) screen size in format [x, y, w, h]\n\n> [!NOTE]\n> If the aspect ratio of the size parameter is not the same as the aspect ratio of the video file, black bars will be visibile. The video will not be stretched"},{"name":"color","type":"Array of Numbers","optional":true,"default":"[1,1,1,1]","description":"foreground color in format [r, g, b, a]","types":["Array","Number"],"since":null,"text":"color: Array of Numbers - (Optional, default [1,1,1,1]) foreground color in format [r, g, b, a]"},{"name":"skipVarName","type":"String","optional":true,"default":"\"BIS_fnc_playVideo_skipVideo\"","description":"missionNamespace variable to skip the video when variable is true","types":["String"],"since":null,"text":"skipVarName: String - (Optional, default \"BIS_fnc_playVideo_skipVideo\") missionNamespace variable to skip the video when variable is true"},{"name":"bgColor","type":"Array format Color (RGBA)","optional":true,"default":"[0,0,0,1]","description":"background color in format [r, g, b, a]","types":["Array","Color"],"since":null,"text":"bgColor: Array format Color (RGBA) - (Optional, default: [0,0,0,1]) background color in format [r, g, b, a]"},{"name":"keepAspect","type":"Boolean","optional":true,"default":"true","description":"true to keep original video aspect ratio (background color will fill the void), false to stretch","types":["Boolean"],"since":null,"text":"keepAspect: Boolean - (Optional, default true) true to keep original video aspect ratio (background color will fill the void), false to stretch"}],"returns":{"type":"Boolean","types":["Boolean"],"description":"true","text":"Boolean - true"}}],"examples":[{"text":"```sqf\nprivate _video = [\"A3\\Missions_F_EPA\\video\\A_in_intro.ogv\"] spawn BIS_fnc_playVideo;\n```","code":["private _video = [\"A3\\Missions_F_EPA\\video\\A_in_intro.ogv\"] spawn BIS_fnc_playVideo;"]},{"text":"```sqf\nprivate _video = [\"\\a3\\missions_f_exp\\video\\exp_m04_v01.ogv\"] call BIS_fnc_playVideo;\n```","code":["private _video = [\"\\a3\\missions_f_exp\\video\\exp_m04_v01.ogv\"] call BIS_fnc_playVideo;"]},{"text":"```sqf\n_video = \"a3\\missions_f_exp\\video\\exp_m07_vout.ogv\";\n_screen = \"Land_TripodScreen_01_large_F\" createVehicle (player modelToWorld [0,10,0]);\n_screen setObjectTexture [0, _video];\n[_video, [10, 10]] call BIS_fnc_playVideo;\n```","code":["_video = \"a3\\missions_f_exp\\video\\exp_m07_vout.ogv\";\n_screen = \"Land_TripodScreen_01_large_F\" createVehicle (player modelToWorld [0,10,0]);\n_screen setObjectTexture [0, _video];\n[_video, [10, 10]] call BIS_fnc_playVideo;"]},{"text":"How to stop the video:\n- call or spawn the function with an empty string: \n\n```sqf\n[\"\"] call BIS_fnc_playVideo;\n```\n\n- call or spawn the function with another video: \n\n```sqf\n[\"\\a3\\missions_f_exp\\video\\exp_m04_v02.ogv\"] call BIS_fnc_playVideo;\n```\n\n- set the variable \"BIS_fnc_playVideo_skipVideo\" to true: \n\n```sqf\nmissionNamespace setVariable [\"BIS_fnc_playVideo_skipVideo\", true];\n```\n\n- set the custom skip variable (*skipVarName*) to true: \n\n```sqf\nmissionNamespace setVariable [\"MyCustomSkipVar\", true];\nsleep 1;\nmissionNamespace setVariable [\"MyCustomSkipVar\", nil]; // so it can be reused later\n```","code":["[\"\"] call BIS_fnc_playVideo;","[\"\\a3\\missions_f_exp\\video\\exp_m04_v02.ogv\"] call BIS_fnc_playVideo;","missionNamespace setVariable [\"BIS_fnc_playVideo_skipVideo\", true];","missionNamespace setVariable [\"MyCustomSkipVar\", true];\nsleep 1;\nmissionNamespace setVariable [\"MyCustomSkipVar\", nil]; // so it can be reused later"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["Functions Library"],"notes":[{"user":"Dedmen","date":"2019-11-11T18:31:00Z","text":"Example ffmpeg command to encode a ogv video which can be played back.\n\n```sqf\nffmpeg -i input.mp4 -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 intro.ogv\n```\n\nSee OGV File Format."}],"categories":["Arma 2: Operation Arrowhead: Functions","Arma 2: Operation Arrowhead: New Functions","Arma 3: Functions","Function Group: GUI","Functions","Functions: Local Effect","Introduced with Arma 2: Operation Arrowhead version 1.56","Take On Helicopters: Functions"],"docblock":null,"filled_from_docblock":[]}