Skip to content

Commit dcb3c1b

Browse files
committed
docs
1 parent d759476 commit dcb3c1b

1 file changed

Lines changed: 61 additions & 1 deletion

File tree

doc/source/apis.rst

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,74 @@ unless you blacklist it. Use it in your app like this::
7272
from android.permissions import request_permissions, Permission
7373
request_permissions([Permission.WRITE_EXTERNAL_STORAGE])
7474

75-
The available permissions are listed here:
75+
The available permissions are listed here:/^^^
7676

7777
https://developer.android.com/reference/android/Manifest.permission
7878

7979

8080
Other common tasks
8181
------------------
8282

83+
Running executables
84+
~~~~~~~~~~~~~~~~~~~
85+
86+
Android enforces strict restrictions on executing files from application
87+
data directories.
88+
89+
The ``android`` module works around this by creating symlinks to a small
90+
set of supported executables in an internal, executable directory. This
91+
directory is added to ``PATH``, allowing these executables to be invoked
92+
from anywhere.
93+
94+
Currently supported executables are:
95+
96+
- ``python``
97+
- ``python3``
98+
- ``ffmpeg``
99+
100+
Importing the ``android`` module is relatively expensive (≈1–2 seconds
101+
on low-end devices), so it should be avoided during early startup unless
102+
required.
103+
104+
Minimal FFmpeg example
105+
^^^^^^^^^^^^^^^^^^^^^^
106+
107+
The following example performs a minimal FFmpeg sanity check using an
108+
in-memory test source and discarding the output::
109+
110+
import android
111+
import subprocess
112+
113+
subprocess.run(
114+
["ffmpeg", "-f", "lavfi", "-i", "testsrc", "-t", "1", "-f", "null", "-"],
115+
check=True
116+
)
117+
118+
This can be used to verify that ``ffmpeg`` is available and executable on
119+
the device.
120+
121+
Requirements
122+
^^^^^^^^^^^^
123+
124+
If you plan to use ``ffmpeg``, ensure it is included in your build
125+
requirements.
126+
127+
If video encoding is required, the following codec options must also be
128+
enabled in the build configuration:
129+
130+
- ``av_codecs``
131+
- ``libx264``
132+
133+
Without these, FFmpeg may be present but lack the necessary codec
134+
support.
135+
136+
See also
137+
^^^^^^^^
138+
139+
.. _APK native library execution restrictions:
140+
https://github.com/agnostic-apollo/Android-Docs/blob/master/site/pages/en/projects/docs/apps/processes/app-data-file-execute-restrictions.md#apk-native-library
141+
142+
83143
Dismissing the splash screen
84144
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85145

0 commit comments

Comments
 (0)