renpy/doc/movie.html
2023-01-18 23:13:55 +01:00

439 lines
29 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Movie &#8212; Ren&#39;Py Documentation</title>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-3.3.6/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Voice" href="voice.html" />
<link rel="prev" title="Audio" href="audio.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head><body>
<div id="navbar" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
Ren&#39;Py Documentation</a>
<span class="navbar-text navbar-version pull-left"><b>7.5.3</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li><a href="https://www.renpy.org">Home Page</a></li>
<li><a href="https://www.renpy.org/doc/html/">Online Documentation</a></li>
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui.html">GUI Customization Guide</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="language_basics.html">Language Basics</a></li>
<li class="toctree-l1"><a class="reference internal" href="label.html">Labels &amp; Control Flow</a></li>
<li class="toctree-l1"><a class="reference internal" href="dialogue.html">Dialogue and Narration</a></li>
<li class="toctree-l1"><a class="reference internal" href="displaying_images.html">Displaying Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="menus.html">In-Game Menus</a></li>
<li class="toctree-l1"><a class="reference internal" href="python.html">Python Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="conditional.html">Conditional Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="audio.html">Audio</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Movie</a></li>
<li class="toctree-l1"><a class="reference internal" href="voice.html">Voice</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="text.html">Text</a></li>
<li class="toctree-l1"><a class="reference internal" href="translation.html">Translation</a></li>
<li class="toctree-l1"><a class="reference internal" href="displayables.html">Displayables</a></li>
<li class="toctree-l1"><a class="reference internal" href="transforms.html">Transforms</a></li>
<li class="toctree-l1"><a class="reference internal" href="transitions.html">Transitions</a></li>
<li class="toctree-l1"><a class="reference internal" href="atl.html">Animation and Transformation Language</a></li>
<li class="toctree-l1"><a class="reference internal" href="matrixcolor.html">Matrixcolor</a></li>
<li class="toctree-l1"><a class="reference internal" href="layeredimage.html">Layered Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="3dstage.html">3D Stage</a></li>
<li class="toctree-l1"><a class="reference internal" href="live2d.html">Live2D Cubism</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="style.html">Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="style_properties.html">Style Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="screens.html">Screens and Screen Language</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_actions.html">Screen Actions, Values, and Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_special.html">Special Screen Names</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_optimization.html">Screen Language Optimization</a></li>
<li class="toctree-l1"><a class="reference internal" href="config.html">Configuration Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="preferences.html">Preference Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="store_variables.html">Store Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="mouse.html">Custom Mouse Cursors</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="launcher.html">Launcher</a></li>
<li class="toctree-l1"><a class="reference internal" href="developer_tools.html">Developer Tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="director.html">Interactive Director</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="nvl_mode.html">NVL-Mode Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="input.html">Text Input</a></li>
<li class="toctree-l1"><a class="reference internal" href="side_image.html">Side Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="rooms.html">Image Gallery, Music Room, and Replay Actions</a></li>
<li class="toctree-l1"><a class="reference internal" href="drag_drop.html">Drag and Drop</a></li>
<li class="toctree-l1"><a class="reference internal" href="sprites.html">Sprites</a></li>
<li class="toctree-l1"><a class="reference internal" href="keymap.html">Customizing the Keymap</a></li>
<li class="toctree-l1"><a class="reference internal" href="achievement.html">Achievements</a></li>
<li class="toctree-l1"><a class="reference internal" href="history.html">Dialogue History</a></li>
<li class="toctree-l1"><a class="reference internal" href="multiple.html">Multiple Character Dialogue</a></li>
<li class="toctree-l1"><a class="reference internal" href="splashscreen_presplash.html">Splashscreen and Presplash</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="statement_equivalents.html">Statement Equivalents</a></li>
<li class="toctree-l1"><a class="reference internal" href="save_load_rollback.html">Saving, Loading, and Rollback</a></li>
<li class="toctree-l1"><a class="reference internal" href="persistent.html">Persistent Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="trans_trans_python.html">Transforms and Transitions in Python</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui_advanced.html">Advanced GUI</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_python.html">Screens and Python</a></li>
<li class="toctree-l1"><a class="reference internal" href="modes.html">Modes</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdd.html">Creator-Defined Displayables</a></li>
<li class="toctree-l1"><a class="reference internal" href="cds.html">Creator-Defined Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="custom_text_tags.html">Custom Text Tags</a></li>
<li class="toctree-l1"><a class="reference internal" href="character_callbacks.html">Character Callbacks</a></li>
<li class="toctree-l1"><a class="reference internal" href="file_python.html">File Access</a></li>
<li class="toctree-l1"><a class="reference internal" href="color_class.html">Color Class</a></li>
<li class="toctree-l1"><a class="reference internal" href="matrix.html">Matrix</a></li>
<li class="toctree-l1"><a class="reference internal" href="model.html">Model-Based Rendering</a></li>
<li class="toctree-l1"><a class="reference internal" href="other.html">Other Functions and Variables</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="build.html">Building Distributions</a></li>
<li class="toctree-l1"><a class="reference internal" href="updater.html">Web Updater</a></li>
<li class="toctree-l1"><a class="reference internal" href="android.html">Android</a></li>
<li class="toctree-l1"><a class="reference internal" href="chromeos.html">Chrome OS/Chromebook</a></li>
<li class="toctree-l1"><a class="reference internal" href="ios.html">iOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="iap.html">In-App Purchasing</a></li>
<li class="toctree-l1"><a class="reference internal" href="gesture.html">Gestures</a></li>
<li class="toctree-l1"><a class="reference internal" href="raspi.html">Raspberry Pi</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="security.html">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="problems.html">Dealing with Problems</a></li>
<li class="toctree-l1"><a class="reference internal" href="environment_variables.html">Environment Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="self_voicing.html">Self-Voicing</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="editor.html">Text Editor Integration</a></li>
<li class="toctree-l1"><a class="reference internal" href="skins.html">Skins</a></li>
<li class="toctree-l1"><a class="reference internal" href="translating_renpy.html">Translating Ren'Py</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog (Ren'Py 7.x-)</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog6.html">Changelog (Ren'Py 6.11 - 6.99)</a></li>
<li class="toctree-l1"><a class="reference internal" href="incompatible.html">Incompatible Changes</a></li>
<li class="toctree-l1"><a class="reference internal" href="distributor.html">Distributor Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="credits.html">Credits</a></li>
<li class="toctree-l1"><a class="reference internal" href="sponsors.html">Ren'Py Development Sponsors</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="thequestion.html">Script of The Question</a></li>
<li class="toctree-l1"><a class="reference internal" href="thequestion_nvl.html">NVL-mode script for The Question</a></li>
</ul>
</ul>
</li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-3">
<div id="sidebar" class="bs-sidenav" role="complementary"><ul>
<li><a class="reference internal" href="#">Movie</a><ul>
<li><a class="reference internal" href="#fullscreen-movies">Fullscreen Movies</a></li>
<li><a class="reference internal" href="#movie-displayables-and-movie-sprites">Movie Displayables and Movie Sprites</a></li>
<li><a class="reference internal" href="#python-functions">Python Functions</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="col-md-9 content">
<div class="section" id="movie">
<span id="id1"></span><h1>Movie<a class="headerlink" href="#movie" title="Permalink to this headline"> link</a></h1>
<p>Ren'Py is capable of using FFmpeg (included) to play movies using the
video codecs:</p>
<ul class="simple">
<li>VP9</li>
<li>VP8</li>
<li>Theora</li>
<li>MPEG-4 part 2 (including Xvid and DivX)</li>
<li>MPEG-2</li>
<li>MPEG-1</li>
</ul>
<p>and the following audio codecs:</p>
<ul class="simple">
<li>Opus</li>
<li>Vorbis</li>
<li>MP3</li>
<li>MP2</li>
<li>PCM</li>
</ul>
<p>inside the following container formats:</p>
<ul class="simple">
<li>WebM</li>
<li>Matroska</li>
<li>Ogg</li>
<li>AVI</li>
<li>Various kinds of MPEG stream.</li>
</ul>
<p>(Note that using some of these formats may require patent licenses.
When in doubt, and especially for commercial games, we recommend using
VP9, VP8, or Theora; Opus or Vorbis; and WebM, Matroska, or Ogg.)</p>
<p>Movies can be displayed fullscreen or in a displayable. Fullscreen movies
are more efficient.</p>
<p>Ren'Py's movie decoder does not support movies with alpha channels, but the
<cite>side_mask</cite> parameter of the <a class="reference internal" href="#Movie" title="Movie"><code class="xref py py-func docutils literal notranslate"><span class="pre">Movie()</span></code></a> displayable can be used for that
purpose. Here is an example of hhow to use ffmpeg to create a webm file with
a side-by-side mask from a mov file with an alpha channel.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="n">ffmpeg</span> <span class="o">-</span><span class="n">i</span> <span class="n">original</span><span class="o">.</span><span class="n">mov</span> <span class="o">-</span><span class="nb">filter</span><span class="p">:</span><span class="n">v</span> <span class="n">alphaextract</span> <span class="na">mask</span><span class="o">.</span><span class="n">mov</span>
<span class="n">ffmpeg</span> <span class="o">-</span><span class="n">i</span> <span class="n">original</span><span class="o">.</span><span class="n">mov</span> <span class="o">-</span><span class="n">i</span> <span class="na">mask</span><span class="o">.</span><span class="n">mov</span> <span class="o">-</span><span class="n">filter_complex</span> <span class="s2">&quot;hstack&quot;</span> <span class="o">-</span><span class="n">codec</span><span class="p">:</span><span class="n">v</span> <span class="n">vp8</span> <span class="o">-</span><span class="n">crf</span> <span class="mi">10</span> <span class="n">output</span><span class="o">.</span><span class="n">webm</span>
</pre></div>
</div>
<p>Movies are not supported on the Web platform.</p>
<div class="section" id="fullscreen-movies">
<h2>Fullscreen Movies<a class="headerlink" href="#fullscreen-movies" title="Permalink to this headline"> link</a></h2>
<p>The easiest and most efficient way to display a movie fullscreen is
to use the <a class="reference internal" href="#renpy.movie_cutscene" title="renpy.movie_cutscene"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.movie_cutscene()</span></code></a> function. This function displays the
movie fullscreen until it either ends, or the player clicks to dismiss
it.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">$</span> <span class="n">renpy</span><span class="o">.</span><span class="n">movie_cutscene</span><span class="p">(</span><span class="s2">&quot;On_Your_Mark.webm&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>On mobile platforms, such as Android and iOS, hardware video decoding is
used when <a class="reference internal" href="config.html#var-config.hw_video"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.hw_video</span></code></a> is changed to True. This can be faster, but the list of
supported movie formats depends on the
platform. See for instance
<a class="reference external" href="https://developer.android.com/guide/topics/media/media-formats">Android's supported media formats</a>.
A quick way to test if your videos are supported is to copy them to your target device and play them with its default video player.</p>
</div>
<div class="section" id="movie-displayables-and-movie-sprites">
<h2>Movie Displayables and Movie Sprites<a class="headerlink" href="#movie-displayables-and-movie-sprites" title="Permalink to this headline"> link</a></h2>
<p>The Movie displayable can be used to display a movie anywhere Ren'Py can
show a displayable. For example, a movie can be displayed as the background
of a menu screen, or as a background.</p>
<p>The Movie displayable can also be used to define a movie sprite, which is
a sprite that is backed by two movies. The primary movie provides the
color of the sprite. A second movie, the mask movie, provides the alpha
channel, with white being full opacity and black being full transparency.</p>
<p>Movies played by the Movie displayable loop automatically.</p>
<p>Here's an example of defining a movie sprite:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">image</span> <span class="n">eileen</span> <span class="n">movie</span> <span class="o">=</span> <span class="n">Movie</span><span class="p">(</span><span class="k">play</span><span class="o">=</span><span class="s2">&quot;eileen_movie.webm&quot;</span><span class="p">,</span> <span class="n">side_mask</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<p>The movie sprite can be shown using the show statement, which automatically starts the
movie playing. It will be automatically stopped when the displayable is hidden.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">show</span> <span class="n">eileen</span> <span class="n">movie</span>
<span class="n">e</span> <span class="s2">&quot;I&#39;m feeling quite animated today.&quot;</span>
<span class="k">hide</span> <span class="n">eileen</span>
<span class="n">e</span> <span class="s2">&quot;But there&#39;s no point on wasting energy when I&#39;m not around.&quot;</span>
</pre></div>
</div>
<p>A Movie displayable can also be used as part of a screen, provided it is created
during the init phase (for example, as part of an image statement.)</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">image</span> <span class="n">main_menu</span> <span class="o">=</span> <span class="n">Movie</span><span class="p">(</span><span class="k">play</span><span class="o">=</span><span class="s2">&quot;main_menu.ogv&quot;</span><span class="p">)</span>
<span class="k">screen</span> <span class="n">main_menu</span><span class="p">:</span>
<span class="k">add</span> <span class="s2">&quot;main_menu&quot;</span>
<span class="k">textbutton</span> <span class="s2">&quot;Start&quot;</span> <span class="na">action</span> <span class="n">Start</span><span class="p">()</span> <span class="na">xalign</span> <span class="mf">0.5</span> <span class="na">yalign</span> <span class="mf">0.5</span>
</pre></div>
</div>
<p>Multiple movie displayables or sprites can be displayed on the screen at once,
subject to system performance, and provided all share the same framerate. The
behavior of Ren'Py when displaying movies with different framerates is
undefined, but will likely include a significant amount of frame drop.</p>
</div>
<div class="section" id="python-functions">
<h2>Python Functions<a class="headerlink" href="#python-functions" title="Permalink to this headline"> link</a></h2>
<dl class="function">
<dt id="renpy.movie_cutscene">
<code class="descclassname">renpy.</code><code class="descname">movie_cutscene</code><span class="sig-paren">(</span><em>filename</em>, <em>delay=None</em>, <em>loops=0</em>, <em>stop_music=True</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.movie_cutscene" title="Permalink to this definition"> link</a></dt>
<dd><p>This displays a movie cutscene for the specified number of
seconds. The user can click to interrupt the cutscene.
Overlays and Underlays are disabled for the duration of the cutscene.</p>
<dl class="docutils">
<dt><cite>filename</cite></dt>
<dd>The name of a file containing any movie playable by Ren'Py.</dd>
<dt><cite>delay</cite></dt>
<dd>The number of seconds to wait before ending the cutscene.
Normally the length of the movie, in seconds. If None, then the
delay is computed from the number of loops (that is, loops + 1) *
the length of the movie. If -1, we wait until the user clicks.</dd>
<dt><cite>loops</cite></dt>
<dd>The number of extra loops to show, -1 to loop forever.</dd>
</dl>
<p>Returns True if the movie was terminated by the user, or False if the
given delay elapsed uninterrupted.</p>
</dd></dl>
<dl class="function">
<dt id="Movie">
<code class="descname">Movie</code><span class="sig-paren">(</span><em>fps=24</em>, <em>size=None</em>, <em>channel=u'movie'</em>, <em>play=None</em>, <em>mask=None</em>, <em>mask_channel=None</em>, <em>image=None</em>, <em>play_callback=None</em>, <em>side_mask=False</em>, <em>loop=True</em>, <em>start_image=None</em>, <em>**properties</em><span class="sig-paren">)</span><a class="headerlink" href="#Movie" title="Permalink to this definition"> link</a></dt>
<dd><p>This is a displayable that shows the current movie.</p>
<dl class="docutils">
<dt><cite>fps</cite></dt>
<dd>The framerate that the movie should be shown at. (This is currently
ignored, but the parameter is kept for backwards compatibility.
The framerate is auto-detected.)</dd>
<dt><cite>size</cite></dt>
<dd>This should be specified as either a tuple giving the width and
height of the movie, or None to automatically adjust to the size
of the playing movie. (If None, the displayable will be (0, 0)
when the movie is not playing.)</dd>
<dt><cite>channel</cite></dt>
<dd>The audio channel associated with this movie. When a movie file
is played on that channel, it will be displayed in this Movie
displayable. If this is left at the default of &quot;movie&quot;, and <cite>play</cite>
is provided, a channel name is automatically selected, using
<a class="reference internal" href="config.html#var-config.single_movie_channel"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.single_movie_channel</span></code></a> and <a class="reference internal" href="config.html#var-config.auto_movie_channel"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.auto_movie_channel</span></code></a>.</dd>
<dt><cite>play</cite></dt>
<dd>If given, this should be the path to a movie file, or a list
of paths to movie files. These movie
files will be automatically played on <cite>channel</cite> when the Movie is
shown, and automatically stopped when the movie is hidden.</dd>
<dt><cite>side_mask</cite></dt>
<dd><p class="first">If true, this tells Ren'Py to use the side-by-side mask mode for
the Movie. In this case, the movie is divided in half. The left
half is used for color information, while the right half is used
for alpha information. The width of the displayable is half the
width of the movie file.</p>
<p class="last">Where possible, <cite>side_mask</cite> should be used over <cite>mask</cite> as it has
no chance of frames going out of sync.</p>
</dd>
<dt><cite>mask</cite></dt>
<dd>If given, this should be the path to a movie file, or a list of paths
to movie files, that are used as
the alpha channel of this displayable. The movie file will be
automatically played on <cite>movie_channel</cite> when the Movie is shown,
and automatically stopped when the movie is hidden.</dd>
<dt><cite>mask_channel</cite></dt>
<dd>The channel the alpha mask video is played on. If not given,
defaults to <cite>channel</cite>_mask. (For example, if <cite>channel</cite> is &quot;sprite&quot;,
<cite>mask_channel</cite> defaults to &quot;sprite_mask&quot;.)</dd>
<dt><cite>start_image</cite></dt>
<dd>An image that is displayed when playback has started, but the
first frame has not yet been decoded.</dd>
<dt><cite>image</cite></dt>
<dd>An image that is displayed when <cite>play</cite> has been given, but the
file it refers to does not exist. (For example, this can be used
to create a slimmed-down mobile version that does not use movie
sprites.) Users can also choose to fall back to this image as a
preference if video is too taxing for their system. The image will
also be used if the video plays, and then the movie ends.</dd>
<dt><cite>play_callback</cite></dt>
<dd><p class="first">If not None, a function that's used to start the movies playing.
(This may do things like queue a transition between sprites, if
desired.) It's called with the following arguments:</p>
<dl class="docutils">
<dt><cite>old</cite></dt>
<dd>The old Movie object, or None if the movie is not playing.</dd>
<dt><cite>new</cite></dt>
<dd>The new Movie object.</dd>
</dl>
<p>A movie object has the <cite>play</cite> parameter available as <code class="docutils literal notranslate"><span class="pre">_play</span></code>,
while the <code class="docutils literal notranslate"><span class="pre">channel</span></code>, <code class="docutils literal notranslate"><span class="pre">loop</span></code>, <code class="docutils literal notranslate"><span class="pre">mask</span></code>, and <code class="docutils literal notranslate"><span class="pre">mask_channel</span></code> fields
correspond to the given parameters.</p>
<p>Generally, this will want to use <a class="reference internal" href="audio.html#renpy.music.play" title="renpy.music.play"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.music.play()</span></code></a> to start
the movie playing on the given channel, with synchro_start=True.
A minimal implementation is:</p>
<div class="last highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">play_callback</span><span class="p">(</span><span class="k">old</span><span class="p">,</span> <span class="k">new</span><span class="p">):</span>
<span class="n">renpy</span><span class="o">.</span><span class="k">music</span><span class="o">.</span><span class="k">play</span><span class="p">(</span><span class="k">new</span><span class="o">.</span><span class="n">_play</span><span class="p">,</span> <span class="n">channel</span><span class="o">=</span><span class="k">new</span><span class="o">.</span><span class="n">channel</span><span class="p">,</span> <span class="n">loop</span><span class="o">=</span><span class="k">new</span><span class="o">.</span><span class="n">loop</span><span class="p">,</span> <span class="n">synchro_start</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="k">if</span> <span class="k">new</span><span class="o">.</span><span class="na">mask</span><span class="p">:</span>
<span class="n">renpy</span><span class="o">.</span><span class="k">music</span><span class="o">.</span><span class="k">play</span><span class="p">(</span><span class="k">new</span><span class="o">.</span><span class="na">mask</span><span class="p">,</span> <span class="n">channel</span><span class="o">=</span><span class="k">new</span><span class="o">.</span><span class="n">mask_channel</span><span class="p">,</span> <span class="n">loop</span><span class="o">=</span><span class="k">new</span><span class="o">.</span><span class="n">loop</span><span class="p">,</span> <span class="n">synchro_start</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
</dd>
<dt><cite>loop</cite></dt>
<dd>If False, the movie will not loop. If <cite>image</cite> is defined, the image
will be displayed when the movie ends. Otherwise, the displayable will
become transparent.</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2012-2022, Tom Rothamel.<br/>
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.6.<br/>
</p>
</div>
</footer>
</body>
</html>