class MediaPlayer
- Extends:
- UIComponent
Description:
Media player is an audio and video player component capable of playing video & audio files, video & audio streams, video & audio from URL, and from audio & video capture devices, like microphone, web cam and other video capture devices.
It's done with the help of pre-installed FFMPEG, so FFMPEG is required to be installed for this to work. FFMPEG is a free open-source software.
Constructor
constructor([ffmpeg_path])
Initializes the MediaPlayer UI component.
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
string |
Optional path to FFMPEG executable. If omitted, the command |
Members
- [ static enum ] Interpolation
- [ static enum ] State
- [ static enum ] SubtitleStyle
- [ readonly ] audioInputDevices
- [ readonly ] audioOutputDevices
- [ readonly ] container
- [ readonly ] hardwareAccelerations
- [ readonly ] id
- [ readonly ] parent
- [ readonly ] screenPosition
- [ readonly ] state
- [ readonly ] videoInputDevices
Methods
From this class:
- audioOutputDevice()
- [ static ] ffmpegPath()
- fit()
- hardwareAcceleration()
- interpolation()
- loop()
- mute()
- onPlayerEvents()
- pause()
- play()
- seek()
- setFile()
- setInputDevice()
- setURL()
- stop()
- subtitleBackground()
- subtitleStyle()
- visualizer()
Inherited from UIComponent:
- addTo()
- anchor()
- background()
- border()
- bottom()
- center()
- contextMenu()
- cursor()
- destroy()
- dragAction()
- dragData()
- dragDataType()
- dropAction()
- dropDataType()
- emit()
- emitFocusKeyEvents()
- focusable()
- focused()
- getAncestor()
- getWindow()
- height()
- hide()
- icon()
- index()
- isInside()
- layer()
- maxSize()
- minSize()
- move()
- onAncestorEvents()
- onComponentEvents()
- onDispose()
- onDragEvents()
- onDropEvents()
- onError()
- onFocusEvents()
- onKey()
- onMouseEvents()
- onMouseMotion()
- onMouseWheel()
- onPropertyChange()
- opacity()
- position()
- remove()
- right()
- size()
- snapshot()
- text()
- tooltip()
- updateUI()
- verifyComponent()
- visible()
- width()
- x()
- y()
Examples:
Examples of formats of commonly used objects with media player:
VideoDevice {
[name]: string, // Name of the video input device.
id: string, // ID if the video input device.
[formats]: VideoFormat[],// Available video formats (present only when getting video input devices)
[format]: VideoFormat // Chosen video format to use (required when setting a video input device).
}
VideoFormat {
size: string, // Video frame size in pixels
pixel_format: string // Frame image encoding coming out of the device (e.g.: "yuyv422")
[fps]: number // (required only when setting a video input device)
[min_fps]: number, // Minimum available frame rate. For example 7.5 fps.
[max_fps]: number, // Maximum available frame rate. For example 30 fps.
}
AudioDevice {
[name]: string, // Name of audio device.
id: string, // ID of audio device. (required when setting an audio device).
[formats]: AudioFormats[], // Available audio formats (present only when getting audio devices).
[format]: AudioFormat, // Audio format to use (required when setting an audio device).
}
AudioFormat {
channels: number, // Audio channels available
bits: number, // Bits per sample
[rate]: number, // Sample rate in Hz. It's only used for audio input device formats (not output). Set it when setting an audio output device.
[encoding]: string // Audio encoding (e.g.: PCM_UNSIGNED, PCM_SIGNED). (Only available in audio output device formats).
}
