class_videostreamplayer.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/VideoStreamPlayer.xml.
  6. .. _class_VideoStreamPlayer:
  7. VideoStreamPlayer
  8. =================
  9. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A control used for video playback.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A control used for playback of :ref:`VideoStream<class_VideoStream>` resources.
  15. Supported video formats are `Ogg Theora <https://www.theora.org/>`__ (``.ogv``, :ref:`VideoStreamTheora<class_VideoStreamTheora>`) and any format exposed via a GDExtension plugin.
  16. \ **Warning:** On Web, video playback *will* perform poorly due to missing architecture-specific assembly optimizations.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`Playing videos <../tutorials/animation/playing_videos>`
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  27. | :ref:`int<class_int>` | :ref:`audio_track<class_VideoStreamPlayer_property_audio_track>` | ``0`` |
  28. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  29. | :ref:`bool<class_bool>` | :ref:`autoplay<class_VideoStreamPlayer_property_autoplay>` | ``false`` |
  30. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  31. | :ref:`int<class_int>` | :ref:`buffering_msec<class_VideoStreamPlayer_property_buffering_msec>` | ``500`` |
  32. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  33. | :ref:`StringName<class_StringName>` | :ref:`bus<class_VideoStreamPlayer_property_bus>` | ``&"Master"`` |
  34. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  35. | :ref:`bool<class_bool>` | :ref:`expand<class_VideoStreamPlayer_property_expand>` | ``false`` |
  36. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  37. | :ref:`bool<class_bool>` | :ref:`loop<class_VideoStreamPlayer_property_loop>` | ``false`` |
  38. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  39. | :ref:`bool<class_bool>` | :ref:`paused<class_VideoStreamPlayer_property_paused>` | ``false`` |
  40. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  41. | :ref:`VideoStream<class_VideoStream>` | :ref:`stream<class_VideoStreamPlayer_property_stream>` | |
  42. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  43. | :ref:`float<class_float>` | :ref:`stream_position<class_VideoStreamPlayer_property_stream_position>` | |
  44. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  45. | :ref:`float<class_float>` | :ref:`volume<class_VideoStreamPlayer_property_volume>` | |
  46. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  47. | :ref:`float<class_float>` | :ref:`volume_db<class_VideoStreamPlayer_property_volume_db>` | ``0.0`` |
  48. +---------------------------------------+--------------------------------------------------------------------------+---------------+
  49. .. rst-class:: classref-reftable-group
  50. Methods
  51. -------
  52. .. table::
  53. :widths: auto
  54. +-----------------------------------+------------------------------------------------------------------------------------------+
  55. | :ref:`float<class_float>` | :ref:`get_stream_length<class_VideoStreamPlayer_method_get_stream_length>`\ (\ ) |const| |
  56. +-----------------------------------+------------------------------------------------------------------------------------------+
  57. | :ref:`String<class_String>` | :ref:`get_stream_name<class_VideoStreamPlayer_method_get_stream_name>`\ (\ ) |const| |
  58. +-----------------------------------+------------------------------------------------------------------------------------------+
  59. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_video_texture<class_VideoStreamPlayer_method_get_video_texture>`\ (\ ) |const| |
  60. +-----------------------------------+------------------------------------------------------------------------------------------+
  61. | :ref:`bool<class_bool>` | :ref:`is_playing<class_VideoStreamPlayer_method_is_playing>`\ (\ ) |const| |
  62. +-----------------------------------+------------------------------------------------------------------------------------------+
  63. | |void| | :ref:`play<class_VideoStreamPlayer_method_play>`\ (\ ) |
  64. +-----------------------------------+------------------------------------------------------------------------------------------+
  65. | |void| | :ref:`stop<class_VideoStreamPlayer_method_stop>`\ (\ ) |
  66. +-----------------------------------+------------------------------------------------------------------------------------------+
  67. .. rst-class:: classref-section-separator
  68. ----
  69. .. rst-class:: classref-descriptions-group
  70. Signals
  71. -------
  72. .. _class_VideoStreamPlayer_signal_finished:
  73. .. rst-class:: classref-signal
  74. **finished**\ (\ ) :ref:`🔗<class_VideoStreamPlayer_signal_finished>`
  75. Emitted when playback is finished.
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Property Descriptions
  80. ---------------------
  81. .. _class_VideoStreamPlayer_property_audio_track:
  82. .. rst-class:: classref-property
  83. :ref:`int<class_int>` **audio_track** = ``0`` :ref:`🔗<class_VideoStreamPlayer_property_audio_track>`
  84. .. rst-class:: classref-property-setget
  85. - |void| **set_audio_track**\ (\ value\: :ref:`int<class_int>`\ )
  86. - :ref:`int<class_int>` **get_audio_track**\ (\ )
  87. The embedded audio track to play.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_VideoStreamPlayer_property_autoplay:
  91. .. rst-class:: classref-property
  92. :ref:`bool<class_bool>` **autoplay** = ``false`` :ref:`🔗<class_VideoStreamPlayer_property_autoplay>`
  93. .. rst-class:: classref-property-setget
  94. - |void| **set_autoplay**\ (\ value\: :ref:`bool<class_bool>`\ )
  95. - :ref:`bool<class_bool>` **has_autoplay**\ (\ )
  96. If ``true``, playback starts when the scene loads.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_VideoStreamPlayer_property_buffering_msec:
  100. .. rst-class:: classref-property
  101. :ref:`int<class_int>` **buffering_msec** = ``500`` :ref:`🔗<class_VideoStreamPlayer_property_buffering_msec>`
  102. .. rst-class:: classref-property-setget
  103. - |void| **set_buffering_msec**\ (\ value\: :ref:`int<class_int>`\ )
  104. - :ref:`int<class_int>` **get_buffering_msec**\ (\ )
  105. Amount of time in milliseconds to store in buffer while playing.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_VideoStreamPlayer_property_bus:
  109. .. rst-class:: classref-property
  110. :ref:`StringName<class_StringName>` **bus** = ``&"Master"`` :ref:`🔗<class_VideoStreamPlayer_property_bus>`
  111. .. rst-class:: classref-property-setget
  112. - |void| **set_bus**\ (\ value\: :ref:`StringName<class_StringName>`\ )
  113. - :ref:`StringName<class_StringName>` **get_bus**\ (\ )
  114. Audio bus to use for sound playback.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_VideoStreamPlayer_property_expand:
  118. .. rst-class:: classref-property
  119. :ref:`bool<class_bool>` **expand** = ``false`` :ref:`🔗<class_VideoStreamPlayer_property_expand>`
  120. .. rst-class:: classref-property-setget
  121. - |void| **set_expand**\ (\ value\: :ref:`bool<class_bool>`\ )
  122. - :ref:`bool<class_bool>` **has_expand**\ (\ )
  123. If ``true``, the video scales to the control size. Otherwise, the control minimum size will be automatically adjusted to match the video stream's dimensions.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_VideoStreamPlayer_property_loop:
  127. .. rst-class:: classref-property
  128. :ref:`bool<class_bool>` **loop** = ``false`` :ref:`🔗<class_VideoStreamPlayer_property_loop>`
  129. .. rst-class:: classref-property-setget
  130. - |void| **set_loop**\ (\ value\: :ref:`bool<class_bool>`\ )
  131. - :ref:`bool<class_bool>` **has_loop**\ (\ )
  132. If ``true``, the video restarts when it reaches its end.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_VideoStreamPlayer_property_paused:
  136. .. rst-class:: classref-property
  137. :ref:`bool<class_bool>` **paused** = ``false`` :ref:`🔗<class_VideoStreamPlayer_property_paused>`
  138. .. rst-class:: classref-property-setget
  139. - |void| **set_paused**\ (\ value\: :ref:`bool<class_bool>`\ )
  140. - :ref:`bool<class_bool>` **is_paused**\ (\ )
  141. If ``true``, the video is paused.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_VideoStreamPlayer_property_stream:
  145. .. rst-class:: classref-property
  146. :ref:`VideoStream<class_VideoStream>` **stream** :ref:`🔗<class_VideoStreamPlayer_property_stream>`
  147. .. rst-class:: classref-property-setget
  148. - |void| **set_stream**\ (\ value\: :ref:`VideoStream<class_VideoStream>`\ )
  149. - :ref:`VideoStream<class_VideoStream>` **get_stream**\ (\ )
  150. The assigned video stream. See description for supported formats.
  151. .. rst-class:: classref-item-separator
  152. ----
  153. .. _class_VideoStreamPlayer_property_stream_position:
  154. .. rst-class:: classref-property
  155. :ref:`float<class_float>` **stream_position** :ref:`🔗<class_VideoStreamPlayer_property_stream_position>`
  156. .. rst-class:: classref-property-setget
  157. - |void| **set_stream_position**\ (\ value\: :ref:`float<class_float>`\ )
  158. - :ref:`float<class_float>` **get_stream_position**\ (\ )
  159. The current position of the stream, in seconds.
  160. \ **Note:** Changing this value won't have any effect as seeking is not implemented yet, except in video formats implemented by a GDExtension add-on.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_VideoStreamPlayer_property_volume:
  164. .. rst-class:: classref-property
  165. :ref:`float<class_float>` **volume** :ref:`🔗<class_VideoStreamPlayer_property_volume>`
  166. .. rst-class:: classref-property-setget
  167. - |void| **set_volume**\ (\ value\: :ref:`float<class_float>`\ )
  168. - :ref:`float<class_float>` **get_volume**\ (\ )
  169. Audio volume as a linear value.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_VideoStreamPlayer_property_volume_db:
  173. .. rst-class:: classref-property
  174. :ref:`float<class_float>` **volume_db** = ``0.0`` :ref:`🔗<class_VideoStreamPlayer_property_volume_db>`
  175. .. rst-class:: classref-property-setget
  176. - |void| **set_volume_db**\ (\ value\: :ref:`float<class_float>`\ )
  177. - :ref:`float<class_float>` **get_volume_db**\ (\ )
  178. Audio volume in dB.
  179. .. rst-class:: classref-section-separator
  180. ----
  181. .. rst-class:: classref-descriptions-group
  182. Method Descriptions
  183. -------------------
  184. .. _class_VideoStreamPlayer_method_get_stream_length:
  185. .. rst-class:: classref-method
  186. :ref:`float<class_float>` **get_stream_length**\ (\ ) |const| :ref:`🔗<class_VideoStreamPlayer_method_get_stream_length>`
  187. The length of the current stream, in seconds.
  188. \ **Note:** For :ref:`VideoStreamTheora<class_VideoStreamTheora>` streams (the built-in format supported by Godot), this value will always be zero, as getting the stream length is not implemented yet. The feature may be supported by video formats implemented by a GDExtension add-on.
  189. .. rst-class:: classref-item-separator
  190. ----
  191. .. _class_VideoStreamPlayer_method_get_stream_name:
  192. .. rst-class:: classref-method
  193. :ref:`String<class_String>` **get_stream_name**\ (\ ) |const| :ref:`🔗<class_VideoStreamPlayer_method_get_stream_name>`
  194. Returns the video stream's name, or ``"<No Stream>"`` if no video stream is assigned.
  195. .. rst-class:: classref-item-separator
  196. ----
  197. .. _class_VideoStreamPlayer_method_get_video_texture:
  198. .. rst-class:: classref-method
  199. :ref:`Texture2D<class_Texture2D>` **get_video_texture**\ (\ ) |const| :ref:`🔗<class_VideoStreamPlayer_method_get_video_texture>`
  200. Returns the current frame as a :ref:`Texture2D<class_Texture2D>`.
  201. .. rst-class:: classref-item-separator
  202. ----
  203. .. _class_VideoStreamPlayer_method_is_playing:
  204. .. rst-class:: classref-method
  205. :ref:`bool<class_bool>` **is_playing**\ (\ ) |const| :ref:`🔗<class_VideoStreamPlayer_method_is_playing>`
  206. Returns ``true`` if the video is playing.
  207. \ **Note:** The video is still considered playing if paused during playback.
  208. .. rst-class:: classref-item-separator
  209. ----
  210. .. _class_VideoStreamPlayer_method_play:
  211. .. rst-class:: classref-method
  212. |void| **play**\ (\ ) :ref:`🔗<class_VideoStreamPlayer_method_play>`
  213. Starts the video playback from the beginning. If the video is paused, this will not unpause the video.
  214. .. rst-class:: classref-item-separator
  215. ----
  216. .. _class_VideoStreamPlayer_method_stop:
  217. .. rst-class:: classref-method
  218. |void| **stop**\ (\ ) :ref:`🔗<class_VideoStreamPlayer_method_stop>`
  219. Stops the video playback and sets the stream position to 0.
  220. \ **Note:** Although the stream position will be set to 0, the first frame of the video stream won't become the current frame.
  221. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  222. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  223. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  224. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  225. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  226. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  227. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  228. .. |void| replace:: :abbr:`void (No return value.)`