vlc.MediaPlayer
- class vlc.MediaPlayer
Bases:
_CtypeIt may take as parameter either:
a string (media URI), options… In this case, an
Instancewill be created.an
Instance, a string (media URI), options…
- add_slave(i_type, psz_uri, b_select)
Add a slave to the current media player.
Note
If the player is playing, the slave will be added directly. This call will also update the slave list of the attached
Media.See
media_slaves_add()- Parameters:
i_type – subtitle or audio.
psz_uri – Uri of the slave (should contain a valid scheme).
b_select – True if this slave should be selected when it’s loaded.
- Returns:
0 on success, -1 on error.
- Version:
LibVLC 3.0.0 and later.
- audio_get_channel()
Get current audio channel.
- Returns:
the audio channel See
AudioOutputChannel.
- audio_get_delay()
Get current audio delay.
- Returns:
the audio delay (microseconds).
- Version:
LibVLC 1.1.1 or later.
- audio_get_mute()
Get current mute status.
- Returns:
the mute status (boolean) if defined, -1 if undefined/unapplicable.
- audio_get_track()
Get current audio track.
- Returns:
the audio track ID or -1 if no active input.
- audio_get_track_count()
Get number of available audio tracks.
- Returns:
the number of available audio tracks (int), or -1 if unavailable.
- audio_get_track_description()
Get the description of available audio tracks.
- audio_get_volume()
Get current software audio volume.
- Returns:
the software volume in percents. (0 = mute, 100 = nominal / 0dB).
- audio_output_device_enum()
Gets a list of potential audio output devices, See
audio_output_device_set().Note
Not all audio outputs support enumerating devices. The audio output may be functional even if the list is empty (None).
Note
The list may not be exhaustive.
Warning
Some audio output devices in the list might not actually work in some circumstances. By default, it is recommended to not specify any explicit audio device.
- Returns:
A None-terminated linked list of potential audio output devices. It must be freed with
audio_output_device_list_release().- Version:
LibVLC 2.2.0 or later.
- audio_output_device_get()
Get the current audio output device identifier.
This complements
audio_output_device_set().Warning
The initial value for the current audio output device identifier may not be set or may be some unknown value. A LibVLC application should compare this value against the known device identifiers (e.g. those that were previously retrieved by a call to
audio_output_device_enum()or libvlc_audio_output_device_list_get) to find the current audio output device.It is possible that the selected audio output device changes (an external change) without a call to
audio_output_device_set(). That may make this method unsuitable to use if a LibVLC application is attempting to track dynamic audio device changes as they happen.- Returns:
the current audio output device identifier. None if no device is selected or in case of error. (the result must be released with free() or libvlc_free).
- Version:
LibVLC 3.0.0 or later.
- audio_output_device_set(module, device_id)
Configures an explicit audio output device.
If the module paramater is None, audio output will be moved to the device specified by the device identifier string immediately. This is the recommended usage.
A list of adequate potential device strings can be obtained with
audio_output_device_enum().However passing None is supported in LibVLC version 2.2.0 and later only; in earlier versions, this function would have no effects when the module parameter was None.
If the module parameter is not None, the device parameter of the corresponding audio output, if it exists, will be set to the specified string. Note that some audio output modules do not have such a parameter (notably MMDevice and PulseAudio).
A list of adequate potential device strings can be obtained with
audio_output_device_list_get().Note
This function does not select the specified audio output plugin.
audio_output_set()is used for that purpose.Warning
The syntax for the device parameter depends on the audio output.
Some audio output modules require further parameters (e.g. a channels map in the case of ALSA).
- Parameters:
module – If None, current audio output module. if non-None, name of audio output module. (See libvlc_audio_output_t).
device_id – device identifier string.
- Returns:
Nothing. Errors are ignored (this is a design bug).
- audio_output_get_device_type()
Stub for backward compatibility.
- Returns:
always -1.
- audio_output_set(psz_name)
Selects an audio output module.
Note
Any change will take be effect only after playback is stopped and restarted. Audio output cannot be changed while playing.
- Parameters:
psz_name – name of audio output, use psz_name of See
AudioOutput.- Returns:
0 if function succeeded, -1 on error.
- audio_output_set_device_type(device_type)
Stub for backward compatibility.
- audio_set_callbacks(play, pause, resume, flush, drain, opaque)
Sets callbacks and private data for decoded audio.
Use
audio_set_format()oraudio_set_format_callbacks()to configure the decoded audio format.Note
The audio callbacks override any other audio output mechanism. If the callbacks are set, LibVLC will not output audio in any way.
- Parameters:
play – callback to play audio samples (must not be None).
pause – callback to pause playback (or None to ignore).
resume – callback to resume playback (or None to ignore).
flush – callback to flush audio buffers (or None to ignore).
drain – callback to drain audio buffers (or None to ignore).
opaque – private pointer for the audio callbacks (as first parameter).
- Version:
LibVLC 2.0.0 or later.
- audio_set_channel(channel)
Set current audio channel.
- Parameters:
channel – the audio channel, See
AudioOutputChannel.- Returns:
0 on success, -1 on error.
- audio_set_delay(i_delay)
Set current audio delay. The audio delay will be reset to zero each time the media changes.
- Parameters:
i_delay – the audio delay (microseconds).
- Returns:
0 on success, -1 on error.
- Version:
LibVLC 1.1.1 or later.
- audio_set_format(format, rate, channels)
Sets a fixed decoded audio format.
This only works in combination with
audio_set_callbacks(), and is mutually exclusive withaudio_set_format_callbacks().- Parameters:
format – a four-characters string identifying the sample format. (e.g. “S16N” or “f32l”).
rate – sample rate (expressed in Hz).
channels – channels count.
- Version:
LibVLC 2.0.0 or later.
- audio_set_format_callbacks(setup, cleanup)
Sets decoded audio format via callbacks.
This only works in combination with
audio_set_callbacks().- Parameters:
setup – callback to select the audio format (cannot be None).
cleanup – callback to release any allocated resources (or None).
- Version:
LibVLC 2.0.0 or later.
- audio_set_mute(status)
Set mute status.
Warning
This function does not always work. If there are no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI…) is in use, muting may be unapplicable. Also some audio output plugins do not support muting at all.
Note
To force silent playback, disable all audio tracks. This is more efficient and reliable than mute.
- Parameters:
status – If status is true then mute, otherwise unmute.
- audio_set_track(i_track)
Set current audio track.
- Parameters:
i_track – the track ID (i_id field from track description).
- Returns:
0 on success, -1 on error.
- audio_set_volume(i_volume)
Set current software audio volume.
- Parameters:
i_volume – the volume in percents (0 = mute, 100 = 0dB).
- Returns:
0 if the volume was set, -1 if it was out of range.
- audio_set_volume_callback(set_volume)
Set callbacks and private data for decoded audio. This only works in combination with
audio_set_callbacks(). Useaudio_set_format()oraudio_set_format_callbacks()to configure the decoded audio format.- Parameters:
set_volume – callback to apply audio volume, or None to apply volume in software.
- Version:
LibVLC 2.0.0 or later.
- audio_toggle_mute()
Toggle mute status.
Warning
Toggling mute atomically is not always possible: On some platforms, other processes can mute the VLC audio playback stream asynchronously. Thus, there is a small race condition where toggling will not work. See also the limitations of
audio_set_mute().
- can_pause()
Can this media player be paused?
- Returns:
true if the media player can pause.
- event_manager()
Get the Event Manager from which the media player send event.
- Returns:
the event manager associated with p_mi.
- get_agl()
Warning
Deprecated! Use
get_nsobject()instead.
- get_chapter()
Get movie chapter.
- Returns:
chapter number currently playing, or -1 if there is no media.
- get_chapter_count()
Get movie chapter count
- Returns:
number of chapters in movie, or -1.
- get_chapter_count_for_title(i_title)
Get title chapter count
- Parameters:
i_title – title.
- Returns:
number of chapters in title, or -1.
- get_fps()
Get movie fps rate
This function is provided for backward compatibility. It cannot deal with multiple video tracks. In LibVLC versions prior to 3.0, it would also fail if the file format did not convey the frame rate explicitly.
Warning
Deprecated! Consider using
media_tracks_get()instead.- Returns:
frames per second (fps) for this playing movie, or 0 if unspecified.
- get_full_chapter_descriptions(i_chapters_of_title)
Get the full description of available chapters.
- Parameters:
i_chapters_of_title – index of the title to query for chapters (uses current title if set to -1).
- Returns:
the chapters list
- Version:
LibVLC 3.0.0 and later.
- get_full_title_descriptions()
Get the full description of available titles.
- Returns:
The titles list.
- Version:
LibVLC 3.0.0 and later.
- get_fullscreen()
Get current fullscreen status.
- Returns:
the fullscreen status (boolean).
- get_hwnd()
Get the Windows API window handle (HWND) previously set with
set_hwnd(). The handle will be returned even if LibVLC is not currently outputting any video to it.- Returns:
a window handle or None if there are none.
- get_instance()
Return the associated
Instance.
- get_length()
Get the current movie length (in ms).
- Returns:
the movie length (in ms), or -1 if there is no media.
- get_media()
Get the media used by the media_player.
- Returns:
the media associated with p_mi, or None if no. media is associated.
- get_nsobject()
Get the NSView handler previously set with
set_nsobject().- Returns:
the NSView handler or 0 if none where set.
- get_position()
Get movie position as percentage between 0.0 and 1.0.
- Returns:
movie position, or -1. in case of error.
- get_rate()
Get the requested movie play rate. .. warning:: Depending on the underlying media, the requested rate may be
different from the real playback rate.
- Returns:
movie play rate.
- get_role()
Gets the media role.
- Returns:
the media player role (libvlc_media_player_role_t).
- Version:
LibVLC 3.0.0 and later.
- get_state()
Get current movie state
- Returns:
the current state of the media player (playing, paused, …) See
State.
- get_time()
Get the current movie time (in ms).
- Returns:
the movie time (in ms), or -1 if there is no media.
- get_title()
Get movie title
- Returns:
title number currently playing, or -1.
- get_title_count()
Get movie title count
- Returns:
title number count, or -1.
- get_xwindow()
Get the X Window System window identifier previously set with
set_xwindow(). Note that this will return the identifier even if VLC is not currently using it (for instance if it is playing an audio-only input).- Returns:
an X window ID, or 0 if none where set.
- has_vout()
How many video outputs does this media player have?
- Returns:
the number of video outputs.
- is_playing()
is_playing
- Returns:
1 if the media player is playing, 0 otherwise.
- is_seekable()
Is this media player seekable?
- Returns:
true if the media player can seek.
Navigate through DVD Menu
- Parameters:
navigate – the Navigation mode.
- Version:
libVLC 2.0.0 or later.
- next_chapter()
Set next chapter (if applicable)
- next_frame()
Display the next frame (if supported)
- pause()
Toggle pause (no effect if there is no media)
- play()
Play
- Returns:
0 if playback started (and was already started), or -1 on error.
- previous_chapter()
Set previous chapter (if applicable)
- program_scrambled()
Check if the current program is scrambled
- Returns:
true if the current program is scrambled.
- Version:
LibVLC 2.2.0 or later.
- release()
Release a media_player after use Decrement the reference count of a media player object. If the reference count is 0, then
release()will release the media player object. If the media player object has been released, then it should not be used again.
- set_agl(drawable)
Warning
Deprecated! Use
set_nsobject()instead.
- set_android_context(p_awindow_handler)
Set the android context.
- Parameters:
p_awindow_handler – org.videolan.libvlc.AWindow jobject owned by the. org.videolan.libvlc.MediaPlayer class from the libvlc-android project.
- Version:
LibVLC 3.0.0 and later.
- set_chapter(i_chapter)
Set movie chapter (if applicable).
- Parameters:
i_chapter – chapter number to play.
- set_equalizer(p_equalizer)
Apply new equalizer settings to a media player.
The equalizer is first created by invoking
audio_equalizer_new()oraudio_equalizer_new_from_preset().It is possible to apply new equalizer settings to a media player whether the media player is currently playing media or not.
Invoking this method will immediately apply the new equalizer settings to the audio output of the currently playing media if there is any.
If there is no currently playing media, the new equalizer settings will be applied later if and when new media is played.
Equalizer settings will automatically be applied to subsequently played media.
To disable the equalizer for a media player invoke this method passing None for the p_equalizer parameter.
The media player does not keep a reference to the supplied equalizer so it is safe for an application to release the equalizer reference any time after this method returns.
- Parameters:
p_equalizer – opaque equalizer handle, or None to disable the equalizer for this media player.
- Returns:
zero on success, -1 on error.
- Version:
LibVLC 2.2.0 or later.
- set_evas_object(p_evas_object)
Set the EFL Evas Object.
- Parameters:
p_evas_object – a valid EFL Evas Object (Evas_Object).
- Returns:
-1 if an error was detected, 0 otherwise.
- Version:
LibVLC 3.0.0 and later.
- set_fullscreen(b_fullscreen)
Enable or disable fullscreen.
Warning
With most window managers, only a top-level windows can be in full-screen mode. Hence, this function will not operate properly if
set_xwindow()was used to embed the video in a non-top-level window. In that case, the embedding window must be reparented to the root window before fullscreen mode is enabled. You will want to reparent it back to its normal parent when disabling fullscreen.- Parameters:
b_fullscreen – boolean for fullscreen status.
- set_hwnd(drawable)
Set a Win32/Win64 API window handle (HWND).
Specify where the media player should render its video output. If LibVLC was built without Win32/Win64 API output support, then this has no effects.
- Parameters:
drawable – windows handle of the drawable.
- set_media(p_md)
Set the media that will be used by the media_player. If any, previous md will be released.
- Parameters:
p_md – the Media. Afterwards the p_md can be safely. destroyed.
- set_mrl(mrl, *options)
Set the MRL to play.
Warning
Most audio and video options, such as text renderer, have no effects on an individual media. These options must be set at the
InstanceorMediaPlayerinstanciation.- Parameters:
mrl – The MRL
options – optional media option=value strings
- Returns:
the Media object
- set_nsobject(drawable)
Set the NSView handler where the media player should render its video output.
Use the vout called “macosx”.
The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding protocol:
@protocol VLCOpenGLVideoViewEmbedding <NSObject> - (void)addVoutSubview:(NSView *)view; - (void)removeVoutSubview:(NSView *)view; @end
Or it can be an NSView object.
If you want to use it along with Qt see the QMacCocoaViewContainer. Then the following code should work:
NSView *video = [[NSView alloc] init]; QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent); libvlc_media_player_set_nsobject(mp, video); [video release];
You can find a live example in VLCVideoView in VLCKit.framework.
- Parameters:
drawable – the drawable that is either an NSView or an object following. the VLCOpenGLVideoViewEmbedding protocol.
- set_pause(do_pause)
Pause or resume (no effect if there is no media)
- Parameters:
do_pause – play/resume if zero, pause if non-zero.
- Version:
LibVLC 1.1.1 or later.
- set_position(f_pos)
Set movie position as percentage between 0.0 and 1.0. This has no effect if playback is not enabled. This might not work depending on the underlying input format and protocol.
- Parameters:
f_pos – the position.
- set_rate(rate)
Set movie play rate
- Parameters:
rate – movie play rate to set.
- Returns:
-1 if an error was detected, 0 otherwise (but even then, it might. not actually work depending on the underlying media protocol).
- set_renderer(p_item)
Set a renderer to the media player
Note
must be called before the first call of
play()to take effect.See
renderer_discoverer_new()- Parameters:
p_item – an item discovered by
renderer_discoverer_start().- Returns:
0 on success, -1 on error.
- Version:
LibVLC 3.0.0 or later.
- set_role(role)
Sets the media role.
- Parameters:
role – the media player role (libvlc_media_player_role_t).
- Returns:
0 on success, -1 on error.
- set_time(i_time)
Set the movie time (in ms). This has no effect if no media is being played. Not all formats and protocols support this.
- Parameters:
i_time – the movie time (in ms).
- set_title(i_title)
Set movie title
- Parameters:
i_title – title number to play.
- set_video_title_display(position, timeout)
Set if, and how, the video title will be shown when media is played.
- Parameters:
position – position at which to display the title, or libvlc_position_disable to prevent the title from being displayed.
timeout – title display timeout in milliseconds (ignored if libvlc_position_disable).
- Version:
libVLC 2.1.0 or later.
- set_xwindow(drawable)
Set an X Window System drawable where the media player should render its video output. The call takes effect when the playback starts. If it is already started, it might need to be stopped before changes apply. If LibVLC was built without X11 output support, then this function has no effects.
By default, LibVLC will capture input events on the video rendering area. Use
video_set_mouse_input()andvideo_set_key_input()to disable that and deliver events to the parent window / to the application instead. By design, the X11 protocol delivers input events to only one recipient.Warning
The application must call the XInitThreads() function from Xlib before
new(), and before any call to XOpenDisplay() directly or via any other library. Failure to call XInitThreads() will seriously impede LibVLC performance. Calling XOpenDisplay() before XInitThreads() will eventually crash the process. That is a limitation of Xlib.Note
The specified identifier must correspond to an existing Input/Output class X11 window. Pixmaps are not currently supported. The default X11 server is assumed, i.e. that specified in the DISPLAY environment variable.
Warning
LibVLC can deal with invalid X11 handle errors, however some display drivers (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle must remain valid until playback is stopped, otherwise the process may abort or crash.
- Parameters:
drawable – X11 window ID.
- Bug:
No more than one window handle per media player instance can be specified. If the media has multiple simultaneously active video tracks, extra tracks. will be rendered into external windows beyond the control of the. application.
- stop()
Stop (no effect if there is no media)
- toggle_fullscreen()
Toggle fullscreen status on non-embedded video outputs.
Warning
The same limitations applies to this function as to
set_fullscreen().
- toggle_teletext()
Toggle teletext transparent status on video output.
Warning
Deprecated! use
video_set_teletext()instead.
- video_get_adjust_float(option)
Get float adjust option.
- Parameters:
option – adjust option to get, values of
VideoAdjustOption.- Version:
LibVLC 1.1.1 and later.
- video_get_adjust_int(option)
Get integer adjust option.
- Parameters:
option – adjust option to get, values of
VideoAdjustOption.- Version:
LibVLC 1.1.1 and later.
- video_get_aspect_ratio()
Get current video aspect ratio.
- Returns:
the video aspect ratio or None if unspecified. (the result must be released with free() or libvlc_free).
- video_get_chapter_description(i_title)
Get the description of available chapters for specific title.
- Parameters:
i_title – selected title.
- Returns:
list containing description of available chapter for title i_title. It must be freed with
track_description_list_release().
- video_get_crop_geometry()
Get current crop filter geometry.
- Returns:
the crop filter geometry or None if unset.
- video_get_cursor(num=0)
Get the mouse pointer coordinates over a video as 2-tuple (x, y).
Coordinates are expressed in terms of the decoded video resolution, not in terms of pixels on the screen/viewport. To get the latter, you must query your windowing system directly.
Either coordinate may be negative or larger than the corresponding size of the video, if the cursor is outside the rendering area.
Warning
The coordinates may be out-of-date if the pointer is not located on the video rendering area. LibVLC does not track the mouse pointer if the latter is outside the video widget.
Note
LibVLC does not support multiple mouse pointers (but does support multiple input devices sharing the same pointer).
- Parameters:
num – video number (default 0).
- video_get_height(num=0)
Get the height of a video in pixels.
- Parameters:
num – video number (default 0).
- video_get_logo_int(option)
Get integer logo option.
- Parameters:
option – logo option to get, values of
VideoLogoOption.
- video_get_marquee_int(option)
Get an integer marquee option value
- Parameters:
option – marq option to get See libvlc_video_marquee_int_option_t.
- video_get_marquee_string(option)
Get a string marquee option value
- Parameters:
option – marq option to get See libvlc_video_marquee_string_option_t.
- video_get_scale()
Get the current video scaling factor. See also
video_set_scale().- Returns:
the currently configured zoom factor, or 0. if the video is set. to fit to the output window/drawable automatically.
- video_get_size(num=0)
Get the video size in pixels as 2-tuple (width, height).
- Parameters:
num – video number (default 0).
- video_get_spu()
Get current video subtitle.
- Returns:
the video subtitle selected, or -1 if none.
- video_get_spu_count()
Get the number of available video subtitles.
- Returns:
the number of available video subtitles.
- video_get_spu_delay()
Get the current subtitle delay. Positive values means subtitles are being displayed later, negative values earlier.
- Returns:
time (in microseconds) the display of subtitles is being delayed.
- Version:
LibVLC 2.0.0 or later.
- video_get_spu_description()
Get the description of available video subtitles.
- video_get_teletext()
Get current teletext page requested or 0 if it’s disabled.
Teletext is disabled by default, call
video_set_teletext()to enable it.- Returns:
the current teletext page requested.
- video_get_title_description()
Get the description of available titles.
- Returns:
list containing description of available titles. It must be freed with
track_description_list_release().
- video_get_track()
Get current video track.
- Returns:
the video track ID (int) or -1 if no active input.
- video_get_track_count()
Get number of available video tracks.
- Returns:
the number of available video tracks (int).
- video_get_track_description()
Get the description of available video tracks.
- video_get_width(num=0)
Get the width of a video in pixels.
- Parameters:
num – video number (default 0).
- video_set_adjust_float(option, value)
Set adjust option as float. Options that take a different type value are ignored.
- Parameters:
option – adust option to set, values of
VideoAdjustOption.value – adjust option value.
- Version:
LibVLC 1.1.1 and later.
- video_set_adjust_int(option, value)
Set adjust option as integer. Options that take a different type value are ignored. Passing libvlc_adjust_enable as option value has the side effect of starting (arg !0) or stopping (arg 0) the adjust filter.
- Parameters:
option – adust option to set, values of
VideoAdjustOption.value – adjust option value.
- Version:
LibVLC 1.1.1 and later.
- video_set_aspect_ratio(psz_aspect)
Set new video aspect ratio.
Note
Invalid aspect ratios are ignored.
- Parameters:
psz_aspect – new video aspect-ratio or None to reset to default.
- video_set_callbacks(lock, unlock, display, opaque)
Set callbacks and private data to render decoded video to a custom area in memory. Use
video_set_format()orvideo_set_format_callbacks()to configure the decoded format.Warning
Rendering video into custom memory buffers is considerably less efficient than rendering in a custom window as normal.
For optimal perfomances, VLC media player renders into a custom window, and does not use this function and associated callbacks. It is highly recommended that other LibVLC-based application do likewise. To embed video in a window, use libvlc_media_player_set_xid or equivalent depending on the operating system.
If window embedding does not fit the application use case, then a custom LibVLC video output display plugin is required to maintain optimal video rendering performances.
The following limitations affect performance:
- Hardware video decoding acceleration will either be disabled completely,
or require (relatively slow) copy from video/DSP memory to main memory.
- Sub-pictures (subtitles, on-screen display, etc.) must be blent into the
main picture by the CPU instead of the GPU.
- Depending on the video format, pixel format conversion, picture scaling,
cropping and/or picture re-orientation, must be performed by the CPU instead of the GPU.
- Memory copying is required between LibVLC reference picture buffers and
application buffers (between lock and unlock callbacks).
- Parameters:
lock – callback to lock video memory (must not be None).
unlock – callback to unlock video memory (or None if not needed).
display – callback to display video (or None if not needed).
opaque – private pointer for the three callbacks (as first parameter).
- Version:
LibVLC 1.1.1 or later.
- video_set_crop_geometry(psz_geometry)
Set new crop filter geometry.
- Parameters:
psz_geometry – new crop filter geometry (None to unset).
- video_set_deinterlace(psz_mode)
Enable or disable deinterlace filter
- Parameters:
psz_mode – type of deinterlace filter, None to disable.
- video_set_format(chroma, width, height, pitch)
Set decoded video chroma and dimensions. This only works in combination with
video_set_callbacks(), and is mutually exclusive withvideo_set_format_callbacks().- Parameters:
chroma – a four-characters string identifying the chroma. (e.g. “RV32” or “YUYV”).
width – pixel width.
height – pixel height.
pitch – line pitch (in bytes).
- Version:
LibVLC 1.1.1 or later.
- Bug:
All pixel planes are expected to have the same pitch. To use the YCbCr color space with chrominance subsampling, consider using
video_set_format_callbacks()instead.
- video_set_format_callbacks(setup, cleanup)
Set decoded video chroma and dimensions. This only works in combination with
video_set_callbacks().- Parameters:
setup – callback to select the video format (cannot be None).
cleanup – callback to release any allocated resources (or None).
- Version:
LibVLC 2.0.0 or later.
- video_set_key_input(on)
Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are handled by the LibVLC video widget.
Note
On X11, there can be only one subscriber for key press and mouse click events per window. If your application has subscribed to those events for the X window ID of the video widget, then LibVLC will not be able to handle key presses and mouse clicks in any case.
Warning
This function is only implemented for X11 and Win32 at the moment.
- Parameters:
on – true to handle key press events, false to ignore them.
- video_set_logo_int(option, value)
Set logo option as integer. Options that take a different type value are ignored. Passing libvlc_logo_enable as option value has the side effect of starting (arg !0) or stopping (arg 0) the logo filter.
- Parameters:
option – logo option to set, values of
VideoLogoOption.value – logo option value.
- video_set_logo_string(option, psz_value)
Set logo option as string. Options that take a different type value are ignored.
- Parameters:
option – logo option to set, values of
VideoLogoOption.psz_value – logo option value.
- video_set_marquee_int(option, i_val)
Enable, disable or set an integer marquee option
Setting libvlc_marquee_Enable has the side effect of enabling (arg !0) or disabling (arg 0) the marq filter.
- Parameters:
option – marq option to set See libvlc_video_marquee_int_option_t.
i_val – marq option value.
- video_set_marquee_string(option, psz_text)
Set a marquee string option
- Parameters:
option – marq option to set See libvlc_video_marquee_string_option_t.
psz_text – marq option value.
- video_set_mouse_input(on)
Enable or disable mouse click events handling. By default, those events are handled. This is needed for DVD menus to work, as well as a few video filters such as “puzzle”.
Warning
This function is only implemented for X11 and Win32 at the moment.
- Parameters:
on – true to handle mouse click events, false to ignore them.
- video_set_scale(f_factor)
Set the video scaling factor. That is the ratio of the number of pixels on screen to the number of pixels in the original decoded video in each dimension. Zero is a special value; it will adjust the video to the output window/drawable (in windowed mode) or the entire screen.
Note that not all video outputs support scaling.
- Parameters:
f_factor – the scaling factor, or zero.
- video_set_spu(i_spu)
Set new video subtitle.
- Parameters:
i_spu – video subtitle track to select (i_id from track description).
- Returns:
0 on success, -1 if out of range.
- video_set_spu_delay(i_delay)
Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, while negative values will result in subtitles being displayed earlier.
The subtitle delay will be reset to zero each time the media changes.
- Parameters:
i_delay – time (in microseconds) the display of subtitles should be delayed.
- Returns:
0 on success, -1 on error.
- Version:
LibVLC 2.0.0 or later.
- video_set_subtitle_file(psz_subtitle)
Set new video subtitle file.
Warning
Deprecated! Use
add_slave()instead.- Parameters:
psz_subtitle – new video subtitle file.
- Returns:
the success status (boolean).
- video_set_teletext(i_page)
Set new teletext page to retrieve.
This function can also be used to send a teletext key.
- Parameters:
i_page – teletex page number requested. This value can be 0 to disable. teletext, a number in the range ]0;1000[ to show the requested page, or a.
TeletextKey. 100 is the default teletext page.
- video_set_track(i_track)
Set video track.
- Parameters:
i_track – the track ID (i_id field from track description).
- Returns:
0 on success, -1 if out of range.
- video_take_snapshot(num, psz_filepath, i_width, i_height)
Take a snapshot of the current video window.
If i_width AND i_height is 0, original size is used. If i_width XOR i_height is 0, original aspect-ratio is preserved.
- Parameters:
num – number of video output (typically 0 for the first/only one).
psz_filepath – the path of a file or a folder to save the screenshot into.
i_width – the snapshot’s width.
i_height – the snapshot’s height.
- Returns:
0 on success, -1 if the video was not found.
- video_update_viewpoint(p_viewpoint, b_absolute)
Update the video viewpoint information.
Note
It is safe to call this function before the media player is started.
Note
the values are set asynchronously, it will be used by the next frame displayed.
- Parameters:
p_viewpoint – video viewpoint allocated via
video_new_viewpoint().b_absolute – if true replace the old viewpoint with the new one. If. false, increase/decrease it.
- Returns:
-1 in case of error, 0 otherwise.
- Version:
LibVLC 3.0.0 and later.
- will_play()
Is the player able to play
- Returns:
boolean.