BIS fnc playVideo: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|arg=|eff=" to "|arg= |eff=")
m (Some wiki formatting)
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


| arma2oa
|game1= arma2oa
|version1= 1.56


|1.56
|game2= tkoh
|version2= 1.00
 
|game3= arma3
|version3= 0.50


|gr1= GUI
|gr1= GUI
Line 11: Line 16:
|eff= local
|eff= local


| 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><br>
|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>
The function also calls "BIS_fnc_playVideo_started" and "BIS_fnc_playVideo_stopped" Scripted Event Handlers in [[missionNamespace]] (see [[BIS_fnc_addScriptedEventHandler]])<br><br>
The function also calls <tt>"BIS_fnc_playVideo_started"</tt> and <tt>"BIS_fnc_playVideo_stopped"</tt> Scripted Event Handlers in [[missionNamespace]] - see [[BIS_fnc_addScriptedEventHandler]] and [[Arma 3: Scripted Event Handlers]].
The video can be stopped in variety of ways:
 
* The function is called or spawned again with empty string "" for the video: <code>[""] [[call]] [[BIS_fnc_playVideo]];</code>
{{Feature | informative |
* The function is called or spawned again with another video, for example "\a3\missions_f_exp\video\exp_m04_v02.ogv"<code>["\a3\missions_f_exp\video\exp_m04_v02.ogv"] [[call]] [[BIS_fnc_playVideo]];</code>
 
* Default variable "BIS_fnc_playVideo_skipVideo" is set to [[true]]: <code>[[missionNamespace]] [[setVariable]] ["BIS_fnc_playVideo_skipVideo", [[true]]];</code>
* to play the video on an object, e.g an in-game screen, see {{HashLink|#Example 3}}
* Custom (skipVarName if defined) variable is set to [[true]]: <code>[[missionNamespace]] [[setVariable]] ["MyCustomSkipVar", [[true]]];</code>
* the video can be stopped in a variety of ways - see {{HashLink|#Example 4}}.
When using skip variable do not forget to reset it to [[nil]] or set it to [[false]] after use. To play video in object, like monitor screen, set it as texture on the object, move UI screen away and start playback (see Example 3)
}}


| [content, size, color, skipVarName, bgColor, keepAspect] spawn [[BIS_fnc_playVideo]]
|s1= [content, size, color, skipVarName, bgColor, keepAspect] spawn [[BIS_fnc_playVideo]]


|p1= content: [[String]] - Full path to .ogv file
|p1= content: [[String]] - Full path to .ogv file


|p2= size (Optional): [[Array]] - Screen size in format [x, y, w, h]. Default: [<nowiki/>[[safeZoneX]], [[safeZoneY]], [[safeZoneW]], [[safeZoneH]]]
|p2= size: [[Array]] - (Optional, default [<nowiki/>[[safeZoneX]], [[safeZoneY]], [[safeZoneW]], [[safeZoneH]]]) screen size in format [x, y, w, h]


|p3= color (Optional): [[Array]] - Foreground color in format [r, g, b, a]. Default: [1,1,1,1]
|p3= color: [[Array]] - (Optional, default [1,1,1,1]) foreground color in format [r, g, b, a]


|p4= skipVarName (Optional): [[String]] - [[missionNamespace]] variable to skip the video when variable is [[true]]. Default: "BIS_fnc_playVideo_skipVideo"
|p4= skipVarName: [[String]] - (Optional, default "BIS_fnc_playVideo_skipVideo") [[missionNamespace]] variable to skip the video when variable is [[true]]


|p5= bgColor (Optional): [[Array]] - Background color in format [r, g, b, a]. Default: [0,0,0,1]
|p5= bgColor: [[Array]] - (Optional, default: [0,0,0,1]) background color in format [r, g, b, a]


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


| [[Boolean]] - [[true]]
|r1= [[Boolean]] - [[true]]


|x1= <code>_video = ["A3\Missions_F_EPA\video\A_in_intro.ogv"] [[spawn]] [[BIS_fnc_playVideo]];</code>
|x1= <code>_video = ["A3\Missions_F_EPA\video\A_in_intro.ogv"] [[spawn]] [[BIS_fnc_playVideo]];</code>
Line 44: Line 49:
_screen [[setObjectTexture]] [0, _video];
_screen [[setObjectTexture]] [0, _video];
[_video, [10, 10]] [[call]] [[BIS_fnc_playVideo]];</code>
[_video, [10, 10]] [[call]] [[BIS_fnc_playVideo]];</code>
|x4= How to stop the video:
* call or spawn the function with an empty string: <code>[""] [[call]] [[BIS_fnc_playVideo]];</code>
* call or spawn the function with another video: <code>["\a3\missions_f_exp\video\exp_m04_v02.ogv"] [[call]] [[BIS_fnc_playVideo]];</code>
* set the variable "BIS_fnc_playVideo_skipVideo" to [[true]]: <code>[[missionNamespace]] [[setVariable]] ["BIS_fnc_playVideo_skipVideo", [[true]]];</code>
* set the custom skip variable (''skipVarName'') to [[true]]: <code>[[missionNamespace]] [[setVariable]] ["MyCustomSkipVar", [[true]]];<br>[[sleep]] 1;<br>[[missionNamespace]] [[setVariable]] ["MyCustomSkipVar", [[nil]]]; {{cc|so it can be reused later}}</code>


|seealso= [[Functions Library]]
|seealso= [[Functions Library]]
}}
}}


<dl class="command_description">


[[Category:{{Name|arma2oa}}: Functions|{{uc:playVideo}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:playVideo}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:playVideo}}]]
<dl class="command_description">
<dt></dt>
<dt></dt>
<dd class="notedate">Posted on November 11, 2019 - 18:31 (UTC)</dd>
<dd class="notedate">Posted on November 11, 2019 - 18:31 (UTC)</dd>
Line 61: Line 67:
Example ffmpeg command to encode a ogv video which can be played back.
Example ffmpeg command to encode a ogv video which can be played back.
<code>ffmpeg -i input.mp4 -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 intro.ogv</code>
<code>ffmpeg -i input.mp4 -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 intro.ogv</code>
</dd>


</dd>
</dl>
</dl>

Revision as of 19:06, 10 June 2021

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.
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 - (Optional, default [safeZoneX, safeZoneY, safeZoneW, safeZoneH]) screen size in format [x, y, w, h]
color: Array - (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 - (Optional, default: [0,0,0,1]) background color in format [r, g, b, a]
keepAspect (Optional): Boolean - true to keep original video aspect ratio (background color will fill the void), false to stretch. Default: true
Return Value:
Boolean - true

Examples

Example 1:
_video = ["A3\Missions_F_EPA\video\A_in_intro.ogv"] spawn BIS_fnc_playVideo;
Example 2:
_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
Posted on November 11, 2019 - 18:31 (UTC)
Dedmen
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