MediaPlayer class abstract

This class provides media player functions and supports multiple instances.

Implementers

Constructors

MediaPlayer()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

adjustPlayoutVolume(int volume) Future<void>
Adjusts the local playback volume.
adjustPublishSignalVolume(int volume) Future<void>
Adjusts the volume of the media file for publishing.
getDuration() Future<int>
Gets the duration of the media resource.
getMediaPlayerId() int
Gets the ID of the media player.
getMute() Future<bool>
Reports whether the media resource is muted.
getPlayoutVolume() Future<int>
Gets the local playback volume.
getPlayPosition() Future<int>
Gets current local playback progress.
getPlaySrc() Future<String>
Gets the path of the media resource being played.
getPublishSignalVolume() Future<int>
Gets the volume of the media file for publishing.
getState() Future<MediaPlayerState>
Gets current playback state.
getStreamCount() Future<int>
Gets the number of the media streams in the media resource.
getStreamInfo(int index) Future<PlayerStreamInfo>
Gets the detailed information of the media stream.
mute(bool muted) Future<void>
Sets whether to mute the media file.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open({required String url, required int startPos}) Future<void>
Opens the media resource.
openWithMediaSource(MediaSource source) Future<void>
Opens a media file and configures the playback scenarios.
pause() Future<void>
Pauses the playback.
play() Future<void>
Plays the media file.
playPreloadedSrc(String src) Future<void>
Plays preloaded media resources.
preloadSrc({required String src, required int startPos}) Future<void>
Preloads a media resource.
registerAudioFrameObserver({required AudioPcmFrameSink observer, RawAudioFrameOpModeType mode = RawAudioFrameOpModeType.rawAudioFrameOpModeReadOnly}) → void
Registers an audio frame observer object.
registerPlayerSourceObserver(MediaPlayerSourceObserver observer) → void
Registers a media player observer.
registerVideoFrameObserver(MediaPlayerVideoFrameObserver observer) → void
Registers a video frame observer object.
resume() Future<void>
Resumes playing the media file.
seek(int newPos) Future<void>
Seeks to a new playback position.
selectAudioTrack(int index) Future<void>
Selects the audio track used during playback.
selectMultiAudioTrack({required int playoutTrackIndex, required int publishTrackIndex}) Future<void>
Selects the audio tracks that you want to play on your local device and publish to the channel respectively.
setAudioDualMonoMode(AudioDualMonoMode mode) Future<void>
Sets the channel mode of the current audio file.
setAudioPitch(int pitch) Future<void>
Sets the pitch of the current media resource.
setLoopCount(int loopCount) Future<void>
Sets the loop playback.
setPlaybackSpeed(int speed) Future<void>
Sets the channel mode of the current audio file.
setPlayerOptionInInt({required String key, required int value}) Future<void>
Set media player options for providing technical previews or special customization features.
setPlayerOptionInString({required String key, required String value}) Future<void>
Set media player options for providing technical previews or special customization features.
setRenderMode(RenderModeType renderMode) Future<void>
Sets the render mode of the media player.
setSpatialAudioParams(SpatialAudioParams params) Future<void>
Enables or disables the spatial audio effect for the media player.
setView(int view) Future<void>
Sets the view.
stop() Future<void>
Stops playing the media track.
switchSrc({required String src, bool syncPts = true}) Future<void>
Switches the media resource being played.
toString() String
A string representation of this object.
inherited
unloadSrc(String src) Future<void>
Unloads media resources that are preloaded.
unregisterAudioFrameObserver(AudioPcmFrameSink observer) → void
Unregisters an audio frame observer.
unregisterPlayerSourceObserver(MediaPlayerSourceObserver observer) → void
Releases a media player observer.
unregisterVideoFrameObserver(MediaPlayerVideoFrameObserver observer) → void
Unregisters the video frame observer.

Operators

operator ==(Object other) bool
The equality operator.
inherited