MediaPlayer 类 |
命名空间: LibVLCSharp.Shared
public class MediaPlayer : Internal
MediaPlayer 类型公开以下成员。
名称 | 说明 | |
---|---|---|
MediaPlayer(LibVLC) | Create an empty Media Player object | |
MediaPlayer(Media) | Create a Media Player object from a Media |
名称 | 说明 | |
---|---|---|
AspectRatio |
Get/set current video aspect ratio.
Set to null to reset to default
Invalid aspect ratios are ignored.
| |
AudioDelay |
Get current audio delay (microseconds).
| |
AudioOutputDeviceEnum |
Gets a list of potential audio output devices
Not all audio outputs support enumerating devices. The audio output may be functional even if the list is empty (NULL).
The list may not be exhaustive. 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.
| |
AudioTrack |
Get current audio track ID or -1 if no active input.
| |
AudioTrackCount |
Get the number of available audio tracks (int), or -1 if unavailable
| |
AudioTrackDescription |
Retrive the audio track description
| |
CanPause |
True if the media player can pause
| |
Channel |
Get current audio channel.
| |
Chapter |
Set movie chapter (if applicable).
Get the movie chapter number currently playing, or -1 if there is no media.
| |
ChapterCount |
Get the number of chapters in movie, or -1.
| |
CropGeometry |
Get/Set current crop filter geometry.
Empty string to unset
| |
EnableHardwareDecoding |
Enable/disable hardware decoding in a crossplatform way.
| |
EnableKeyInput |
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.
true to handle key press events, false to ignore them.
| |
EnableMouseInput |
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.
true to handle mouse click events, false to ignore them.
| |
FileCaching |
Caching value for local files, in milliseconds [0 .. 60000ms]
| |
Fps |
Get the frames per second (fps) for this playing movie, or 0 if unspecified
| |
Fullscreen |
Enable or disable fullscreen.
Warning, TL;DR version : Unless you know what you're doing, don't use this.
Put your VideoView inside a fullscreen control instead, refer to your platform documentation.
Warning, long version :
With most window managers, only a top-level windows can be in full-screen mode.
Hence, this function will not operate properly if libvlc_media_player_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.
return the fullscreen status (boolean)
| |
Hwnd |
Set a Win32/Win64 API window handle (HWND) where the media player
should render its video output. If LibVLC was built without
Win32/Win64 API output support, then this has no effects.
Get the Windows API window handle (HWND) previously set
| |
IsPlaying |
return true if the media player is playing, false otherwise
| |
IsSeekable |
True if the media player can seek
| |
Length |
The movie length (in ms), or -1 if there is no media.
| |
Media |
Get the media used by the media_player.
Set the media that will be used by the media_player.
If any, previous md will be released.
Note: It is safe to release the Media on the C# side after it's been set on the MediaPlayer successfully
| |
Mute |
Get current 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.
| |
NativeReference |
The pointer to the native code representation of this object
(继承自 Internal。) | |
NetworkCaching |
Caching value for network resources, in milliseconds [0 .. 60000ms]
| |
NsObject |
Get the NSView handler previously set
return the NSView handler or 0 if none where set
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: VLCOpenGLVideoViewEmbedding NSObject
Or it can be an NSView object.
If you want to use it along with Qt4 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.
| |
OutputDevice |
Get the current audio output device identifier.
This complements SetOutputDevice(String, String)
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 AudioOutputDeviceEnum or
AudioOutputDevices(String)) to find the current audio output device.
It is possible that the selected audio output device changes(an external
change) without a call to SetOutputDevice(String, String).That may make this
method unsuitable to use if a LibVLC application is attempting to track
dynamic audio device changes as they happen.
| |
Position |
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.
Get movie position as percentage between 0.0 and 1.0.
| |
ProgramScambled |
True if the current program is scrambled
LibVLC 2.2.0 or later
| |
Rate |
Get the requested movie play rate.
warning
Depending on the underlying media, the requested rate may be
different from the real playback rate.
| |
Role | Gets the media role.
version LibVLC 3.0.0 and later.
| |
Scale |
Get/Set the current video scaling factor. See also MediaPlayer::setScale() .
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.
| |
Spu |
The current video subtitle track
| |
SpuCount |
Get the number of available video subtitles.
| |
SpuDelay |
Get the current subtitle delay.
| |
SpuDescription |
Retrieve SpuDescription in a TrackDescription struct
| |
State |
Get the current state of the media player (playing, paused, ...)
| |
Teletext |
Get current teletext page requested.
Set new teletext page to retrieve.
| |
Time |
Set the movie time (in ms). This has no effect if no media is being
played. Not all formats and protocols support this.
Get the movie time (in ms), or -1 if there is no media.
| |
Title |
Set movie title number to play
Get movie title number currently playing, or -1
| |
TitleCount |
The title number count, or -1
| |
TitleDescription |
Get the description of available titles.
| |
VideoTrack |
Get current video track ID (int) or -1 if no active input.
| |
VideoTrackCount |
Get number of available video tracks.
| |
VideoTrackDescription |
Get the description of available video tracks.
| |
Viewpoint |
Current 360 viewpoint of this mediaplayer.
Update with UpdateViewpoint(Single, Single, Single, Single, Boolean) | |
Volume |
Get/Set the volume in percents (0 = mute, 100 = 0dB)
| |
VoutCount |
Get the number of video outputs
| |
WillPlay |
True if the player is able to play
| |
XWindow |
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 libvlc_video_set_mouse_input() and libvlc_video_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 libvlc_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.
uint: X11 window ID
|
名称 | 说明 | |
---|---|---|
AddSlave |
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 VLC::Media.
| |
AdjustFloat |
Get adjust option float value
| |
AdjustInt |
Get integer adjust option.
| |
ChapterCountForTitle |
Get the number of chapters in title, or -1
| |
ChapterDescription |
Get the description of available chapters for specific title.
| |
Cursor |
Get the mouse pointer coordinates over a video.
Coordinates are expressed in terms of the decoded video resolution, not in terms of pixels on the screen/viewport
(to get the latter, you can query your windowing system directly).
Either of the coordinates may be negative or larger than the corresponding dimension 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 pointer if it is outside of the video widget.
Note
LibVLC does not support multiple pointers(it does of course support multiple input devices sharing the same pointer) at the moment.
| |
Dispose |
Dispose of this instance
(继承自 Internal。) | |
Dispose(Boolean) |
Dispose override
Effectively stops playback and disposes a media if any
(重写 InternalDispose(Boolean).) | |
Equals |
Equals override based on the native instance reference
(重写 ObjectEquals(Object).) | |
Finalize | (继承自 Object。) | |
FullChapterDescriptions |
Get the full description of available chapters.
| |
GetHashCode |
Custom hascode implemenation for this MediaPlayer instance
(重写 ObjectGetHashCode.) | |
GetType | (继承自 Object。) | |
LogoInt |
Get integer logo option.
| |
MarqueeInt |
Get an integer marquee option value
| |
MarqueeString |
Get a string marquee option value
| |
MemberwiseClone | (继承自 Object。) | |
Navigate |
Navigate through DVD Menu
| |
NextChapter |
Set next chapter (if applicable)
| |
NextFrame |
Display the next frame (if supported)
| |
Pause |
Toggle pause (no effect if there is no media)
| |
Play |
Start playback with Media that is set
If playback was already started, this method has no effect
| |
Play(Media) |
Set media and start playback
| |
PreviousChapter |
Set previous chapter (if applicable)
| |
SetAdjustFloat |
Set adjust option as float. Options that take a different type value are ignored.
| |
SetAdjustInt |
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.
| |
SetAudioCallbacks |
Sets callbacks and private data for decoded audio.
Use libvlc_audio_set_format() or libvlc_audio_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.
| |
SetAudioDelay |
Set current audio delay. The audio delay will be reset to zero each
time the media changes.
| |
SetAudioFormat |
Sets a fixed decoded audio format.
This only works in combination with libvlc_audio_set_callbacks(), and is mutually exclusive with libvlc_audio_set_format_callbacks().
| |
SetAudioFormatCallback |
Sets decoded audio format via callbacks.
This only works in combination with libvlc_audio_set_callbacks().
| |
SetAudioOutput |
Selects an audio output module.
Note:
Any change will take effect only after playback is stopped and restarted. Audio output cannot be changed while playing.
| |
SetAudioTrack |
Set current audio track.
| |
SetChannel |
Set current audio channel.
| |
SetDeinterlace |
Enable or disable deinterlace filter
| |
SetEqualizer |
Apply new equalizer settings to a media player.
The equalizer is first created by invoking libvlc_audio_equalizer_new() or libvlc_audio_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 NULL 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.
| |
SetLogoInt |
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.
| |
SetLogoString |
Set logo option as string. Options that take a different type value are ignored.
| |
SetMarqueeInt |
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.
| |
SetMarqueeString |
Enable, disable or set an string marquee option
| |
SetOutputDevice |
Configures an explicit audio output device.
If the module paramater is NULL, 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
AudioOutputDeviceEnum
However passing NULL 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 NULL.
If the module parameter is not NULL, the device parameter of the
corresponding audio output, if it exists, will be set to the specified
string.
A list of adequate potential device strings can be obtained with
AudioOutputDevices(String) | |
SetPause |
Pause or resume (no effect if there is no media).
version LibVLC 1.1.1 or later
| |
SetRate |
Set movie play rate
| |
SetRenderer |
Set a renderer to the media player.
| |
SetRole | Sets the media role.
version LibVLC 3.0.0 and later.
| |
SetSpu |
Set Spu (subtitle)
| |
SetSpuDelay |
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.
| |
SetVideoCallbacks |
Set callbacks and private data to render decoded video to a custom area in memory.
Use libvlc_video_set_format() or libvlc_video_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).
| |
SetVideoFormat |
Set decoded video chroma and dimensions. This only works in
combination with MediaPlayer::setCallbacks() , and is mutually exclusive
with MediaPlayer::setFormatCallbacks()
| |
SetVideoFormatCallbacks |
Set decoded video chroma and dimensions.
This only works in combination with libvlc_video_set_callbacks().
| |
SetVideoTitleDisplay |
Set if, and how, the video title will be shown when media is played.
| |
SetVideoTrack |
Set video track.
| |
SetVolumeCallback |
Set callbacks and private data for decoded audio.
This only works in combination with libvlc_audio_set_callbacks().
Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks() to configure the decoded audio format.
| |
Size |
Get the pixel dimensions of a video.
| |
Stop |
Stop the playback (no effect if there is no media) 必须在线程里调用,否则容易死锁
warning:
This is synchronous, and will block until all VLC threads have been joined.
Calling this from a VLC callback is a bound to cause a deadlock.
| |
TakeSnapshot |
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.
| |
ToggleFullscreen |
Toggle fullscreen status on non-embedded video outputs.
warning: The same limitations applies to this function as to MediaPlayer::setFullscreen()
| |
ToggleMute |
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 libvlc_audio_set_mute().
| |
ToggleTeletext |
Toggle teletext transparent status on video output.
| |
ToString | (继承自 Object。) | |
UnsetEqualizer |
unsetEqualizer disable equalizer for this media player
| |
UpdateViewpoint |
Update the video viewpoint information.
The values are set asynchronously, it will be used by the next frame displayed.
It is safe to call this function before the media player is started.
LibVLC 3.0.0 and later
|
名称 | 说明 | |
---|---|---|
AudioDevice |
The mediaplayer's audio device changed
| |
Backward |
The mediaplayer went backward in the playback
| |
Buffering |
The mediaplayer is buffering
| |
ChapterChanged |
The mediaplayer changed the chapter of a media
| |
Corked |
The mediaplayer is corked
| |
EncounteredError |
The mediaplayer encountered an error during playback
| |
EndReached |
The mediaplayer reached the end of the playback
| |
ESAdded |
The mediaplayer has a new Elementary Stream (ES)
| |
ESDeleted |
The mediaplayer has one less Elementary Stream (ES)
| |
ESSelected |
An Elementary Stream (ES) was selected
| |
Forward |
The mediaplayer went forward in the playback
| |
LengthChanged |
The length of a playback changed
| |
MediaChanged |
The media of this mediaplayer changed
| |
Muted |
The mediaplayer is muted
| |
NothingSpecial |
Nothing special to report
| |
Opening |
The mediaplayer is opening a media
| |
PausableChanged |
The mediaplayer's pause capability changed
| |
Paused |
The mediaplayer paused playback
| |
Playing |
The mediaplayer started playing a media
| |
PositionChanged |
The mediaplayer's position changed
| |
ScrambledChanged |
The mediaplayer scrambled status changed
| |
SeekableChanged |
The mediaplayer's seek capability changed
| |
SnapshotTaken |
The mediaplayer took a snapshot
| |
Stopped |
The mediaplayer stopped playback
| |
TimeChanged |
The mediaplayer's playback time changed
| |
TitleChanged |
The title of the mediaplayer changed
| |
Uncorked |
The mediaplayer is uncorked
| |
Unmuted |
The mediaplayer is unmuted
| |
VolumeChanged |
The mediaplayer's volume changed
| |
Vout |
The Video Output count of the MediaPlayer changed
|
名称 | 说明 | |
---|---|---|
IsDisposed |
Indicates whether this object has already been disposed
(继承自 Internal。) | |
Release |
Release native resources by calling this C function
(继承自 Internal。) |
名称 | 说明 | |
---|---|---|
ConvertTo |
类型转换
(由 ObjectExtenstions 定义。) | |
Delay |
延迟操作
(由 ObjectExtenstions 定义。) | |
Equal |
对象是否相等
(由 ObjectExtenstions 定义。) | |
GetCreationCode | (由 ObjectExtenstions 定义。) | |
GetPropretyValue |
获取对象属性值
(由 ObjectExtenstions 定义。) | |
GetValue |
快速动态获取对象的属性值
(由 FastReflectionExtensions 定义。) | |
Invoke |
快速动态调用对象的方法
(由 FastReflectionExtensions 定义。) | |
SetPropretyValue |
设置属性值
(由 ObjectExtenstions 定义。) | |
SetValue |
快速动态设置对象的属性值
(由 FastReflectionExtensions 定义。) |