BIS fnc playVideo: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (note about black bars)
 
(47 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma2oa
____________________________________________________________________________________________
|version1= 1.56


| arma2oa |= Game name
|game2= tkoh
|version2= 1.00


|1.00|= Game version
|game3= arma3
____________________________________________________________________________________________
|version3= 0.50


| <pre>
|gr1= GUI
/*


Description:
|eff= local
Plays in-game video.


Parameter(s):
|descr= Plays in-game video with a range of options. The function can be [[call]]ed or [[spawn]]ed. If [[spawn]]ed, [[scriptDone]] command can be used to see if video is stopped or finished. If [[call]]ed in scheduled environment, the next line of code will not process until the video is stopped or finished.<br>
_this select 0: STRING - Video path
The function also calls {{hl|"BIS_fnc_playVideo_started"}} and {{hl|"BIS_fnc_playVideo_stopped"}} Scripted Event Handlers in [[missionNamespace]] - see [[BIS_fnc_addScriptedEventHandler]] and [[Arma 3: Scripted Event Handlers]].
_this select 1 (Optional): ARRAY - Size
_this select 2 (Optional): ARRAY - Color
_this select 3 (Optional): STRING - Variable to skip the video


Returns:
{{Feature|informative|
True
* to play the video on an object, e.g an in-game screen, see {{Link|#Example 3}}
*/
* the video can be stopped in a variety of ways - see {{Link|#Example 4}}
* see [[OGV File Format]] for format and conversion information.
}}
 
|s1= [content, size, color, skipVarName, bgColor, keepAspect] spawn [[BIS_fnc_playVideo]]
 
|p1= content: [[String]] - full path to {{hl|.ogv}} file


#define VIDEO_DISPLAY (uinamespace getvariable "BIS_RscMissionScreen_video")
|p2= size: [[Array]] of [[Number]]s - (Optional, default [<nowiki/>[[safeZoneX]], [[safeZoneY]], [[safeZoneW]], [[safeZoneH]]]) screen size in format [x, y, w, h]
#define VIDEO_CONTENT (VIDEO_DISPLAY displayctrl 1100)
{{Feature|informative|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}}


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|p3= color: [[Array]] of [[Number]]s - (Optional, default [1,1,1,1]) foreground color in format [r, g, b, a]
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_playVideo]]; --> |= Syntax
|p4= skipVarName: [[String]] - (Optional, default "BIS_fnc_playVideo_skipVideo") [[missionNamespace]] variable to skip the video when variable is [[true]]


|p1= |= Parameter 1
|p5= bgColor: [[Array]] format [[Color|Color (RGBA)]] - (Optional, default: [0,0,0,1]) background color in format [r, g, b, a]


| |= Return value
|p6= keepAspect: [[Boolean]] - (Optional, default [[true]]) [[true]] to keep original video aspect ratio (background color will fill the void), [[false]] to stretch
____________________________________________________________________________________________


|x1= <code></code> |=
|r1= [[Boolean]] - [[true]]
____________________________________________________________________________________________


| |= See also
|x1= <sqf>private _video = ["A3\Missions_F_EPA\video\A_in_intro.ogv"] spawn BIS_fnc_playVideo;</sqf>


}}
|x2= <sqf>private _video = ["\a3\missions_f_exp\video\exp_m04_v01.ogv"] call BIS_fnc_playVideo;</sqf>
 
|x3= <sqf>
_video = "a3\missions_f_exp\video\exp_m07_vout.ogv";
_screen = "Land_TripodScreen_01_large_F" createVehicle (player modelToWorld [0,10,0]);
_screen setObjectTexture [0, _video];
[_video, [10, 10]] call BIS_fnc_playVideo;
</sqf>


<h3 style="display:none">Notes</h3>
|x4= How to stop the video:
<dl class="command_description">
* call or spawn the function with an empty string: <sqf>[""] call BIS_fnc_playVideo;</sqf>
<!-- Note Section BEGIN -->
* call or spawn the function with another video: <sqf>["\a3\missions_f_exp\video\exp_m04_v02.ogv"] call BIS_fnc_playVideo;</sqf>
* set the variable "BIS_fnc_playVideo_skipVideo" to [[true]]: <sqf>missionNamespace setVariable ["BIS_fnc_playVideo_skipVideo", true];</sqf>
* set the custom skip variable (''skipVarName'') to [[true]]: <sqf>
missionNamespace setVariable ["MyCustomSkipVar", true];
sleep 1;
missionNamespace setVariable ["MyCustomSkipVar", nil]; // so it can be reused later
</sqf>


<!-- Note Section END -->
|seealso= [[Functions Library]]
</dl>
}}


<h3 style="display:none">Bottom Section</h3>
{{Note
[[Category:Function Group: GUI|{{uc:playVideo}}]]
|user= Dedmen
[[Category:Functions|{{uc:playVideo}}]]
|timestamp= 20191111183100
[[Category:{{Name|arma2oa}}: Functions|{{uc:playVideo}}]]
|text= Example ffmpeg command to encode a ogv video which can be played back.
[[Category:{{Name|tkoh}}: Functions|{{uc:playVideo}}]]
<sqf>ffmpeg -i input.mp4 -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 intro.ogv</sqf>
[[Category:{{Name|arma3}}: Functions|{{uc:playVideo}}]]
See [[OGV File Format]].
}}

Latest revision as of 11:28, 13 January 2024

Hover & click on the images for description

Description

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.
The 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.
  • to play the video on an object, e.g an in-game screen, see Example 3
  • the video can be stopped in a variety of ways - see Example 4
  • see OGV File Format for format and conversion information.
Execution:
call
Groups:
GUI

Syntax

Syntax:
[content, size, color, skipVarName, bgColor, keepAspect] spawn BIS_fnc_playVideo
Parameters:
content: String - full path to .ogv file
size: Array of Numbers - (Optional, default [safeZoneX, safeZoneY, safeZoneW, safeZoneH]) screen size in format [x, y, w, h]
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
color: Array of Numbers - (Optional, default [1,1,1,1]) foreground color in format [r, g, b, a]
skipVarName: String - (Optional, default "BIS_fnc_playVideo_skipVideo") missionNamespace variable to skip the video when variable is true
bgColor: Array format Color (RGBA) - (Optional, default: [0,0,0,1]) background color in format [r, g, b, a]
keepAspect: Boolean - (Optional, default true) true to keep original video aspect ratio (background color will fill the void), false to stretch
Return Value:
Boolean - true

Examples

Example 1:
private _video = ["A3\Missions_F_EPA\video\A_in_intro.ogv"] spawn BIS_fnc_playVideo;
Example 2:
private _video = ["\a3\missions_f_exp\video\exp_m04_v01.ogv"] call BIS_fnc_playVideo;
Example 3:
_video = "a3\missions_f_exp\video\exp_m07_vout.ogv"; _screen = "Land_TripodScreen_01_large_F" createVehicle (player modelToWorld [0,10,0]); _screen setObjectTexture [0, _video]; [_video, [10, 10]] call BIS_fnc_playVideo;
Example 4:
How to stop the video:

Additional Information

See also:
Functions Library

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Dedmen - c
Posted on Nov 11, 2019 - 18:31 (UTC)
Example ffmpeg command to encode a ogv video which can be played back.
ffmpeg -i input.mp4 -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 intro.ogv
See OGV File Format.