Player class

Constructors

Player()

Properties

activeAudioTracks List<int>
Active audio tracks set by user
getter/setter pair
activeSubtitleTracks List<int>
Active subtitle tracks set by user
getter/setter pair
activeVideoTracks List<int>
Active video tracks set by user
getter/setter pair
audioBackends List<String>
Set the audio renderer. Can be 'AudioTrack', 'OpenSL' on android.
no getter
audioDecoders List<String>
Set audio decoder priority. Usually not required.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isLive bool
It's a live stream or not.
no setter
loop int
Loop count set by user.
getter/setter pair
media String
Current media.
getter/setter pair
mediaInfo MediaInfo
Media information.
no setter
mediaStatus MediaStatus
Current MediaStatus value
no setter
mute bool
Mute value.
getter/setter pair
nativeHandle int
no setter
playbackRate double
Playback speed set by user.
getter/setter pair
position int
Get current playback position in milliseconds relative to media's first timestamp. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#int64_t-position-const
no setter
preloadImmediately bool
Preload the next media set by setNext immediately or when current playback is finished.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state PlaybackState
Current playback state.
getter/setter pair
textureId ValueNotifier<int?>
for builder
final
textureSize Future<Size?>
no setter
videoDecoders List<String>
Decoder list set by user
getter/setter pair
volume double
Audio volume value
getter/setter pair

Methods

buffered() int
Return buffered duration in milliseconds. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#int64_t-bufferedint64_t-bytes--nullptr-const
bufferedTimeRanges() List<DurationRange>
dispose() → void
Release resources
getProperty(String name) String?
Get property value for name
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onEvent(void callback(MediaEvent)?) → void
Set MediaEvent callback. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-oneventstdfunctionboolconst-mediaevent-cb-callbacktoken-token--nullptr
onMediaStatus(bool callback(MediaStatus oldValue, MediaStatus newValue)?, {bool reply = false}) → void
Add a MediaStatus callback or remove all callbacks. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-onmediastatusstdfunctionboolmediastatus-oldvalue-mediastatus-newvalue-cb-callbacktoken-token--nullptr
onStateChanged(void callback(PlaybackState oldValue, PlaybackState newValue)?, {bool reply = false}) → void
Set a PlaybackState change callback. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-onstatechangedstdfunctionvoidstate-cb
prepare({int position = 0, SeekFlag flags = const SeekFlag(SeekFlag.defaultFlags), Future<bool> callback()?, bool reply = false}) Future<int>
Load the media from position in milliseconds and decode the first frame, then state will be PlaybackState.paused. If error occurs, will be PlaybackState.stopped. Return the result position, or a negative value if failed. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-prepareint64_t-startposition--0-functionboolint64_t-position-bool-boost-cb--nullptr-seekflag-flags--seekflagfromstart
record({String? to, String? format}) → void
Start to record if to is not null. Stop recording if to is null. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-recordconst-char-url--nullptr-const-char-format--nullptr
renderVideo() double
Draw the current video frame and return frame timestamp in seconds. Usually NOT used in dart.
rotate(int degree) → void
rotate video content around the center. degree can be 0, 90, 180, 270 in counterclockwise. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-rotateint-degree-void-vo_opaque--nullptr
scale(double x, double y) → void
scale video content. 1.0 is no scale. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-scalefloat-x-float-y-void-vo_opaque--nullptr
seek({required int position, SeekFlag flags = const SeekFlag(SeekFlag.defaultFlags)}) Future<int>
Seek to position in milliseconds https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#bool-seekint64_t-pos-seekflag-flags-stdfunctionvoidint64_t-ret-cb--nullptr
setActiveTracks(MediaType type, List<int> value) → void
Set active tracks of type. Other tracks of type will be disabled. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setactivetracksmediatype-type-const-stdsetint-tracks
setAspectRatio(double value) → void
Set video content aspect ratio. No effect if texture width/height == original video frame width/height. value can be ignoreAspectRatio, keepAspectRatio, keepAspectRatioCrop and other desired ratio = width/height
setAsset(String asset, {String? package, MediaType? type}) → void
setBackground(Color c) → void
Set background color. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setbackgroundcolorfloat-r-float-g-float-b-float-a-void-vo_opaque--nullptr
setBackgroundColor(double r, double g, double b, double a) → void
Set background color. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setbackgroundcolorfloat-r-float-g-float-b-float-a-void-vo_opaque--nullptr
setBufferRange({int min = -1, int max = -1, bool drop = false}) → void
Set duration range(milliseconds) of buffered data.
setColorSpace(ColorSpace value) → void
Set target color space. Usually NOT used by dart because flutter only supports SDR output. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr
setDecoders(MediaType type, List<String> value) → void
Set decoder priority. Detail: https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setdecodersmediatype-type-const-stdvectorstdstring-names
setMedia(String uri, MediaType type) → void
Set media of type. Can be used to load external audio track and subtitle file. An external media can contains other MediaType tracks although they will not be used. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setmediaconst-char-url-mediatype-type
setNext(String uri, {int from = 0, SeekFlag seekFlag = const SeekFlag(SeekFlag.defaultFlags)}) → void
Set the next media to play when current media playback is finished. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setnextmediaconst-char-url-int64_t-startposition--0-seekflag-flags--seekflagfromstart
setProperty(String name, String value) → void
Set additional properties. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setpropertyconst-stdstring-key-const-stdstring-value
setRange({required int from, int to = -1}) → void
Set position range in milliseconds. Can be used by A-B loop. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setrangeint64_t-a-int64_t-b--int64_max
setVideoEffect(VideoEffect effect, List<double> value) → void
Set a built-in video effect. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setvideoeffect-effect-const-float-values-void-vo_opaque--nullptr
setVideoSurfaceSize(int width, int height) → void
Set video renderer size or destroy renderer. Usually NOT used in dart. https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setvideosurfacesizeint-width-int-height-void-vo_opaque--nullptr
setVideoViewport(double x, double y, double width, double height) → void
snapshot({int? width, int? height}) Future<Uint8List?>
Take a snapshot for current rendered frame.
toString() String
A string representation of this object.
inherited
updateTexture({int? width, int? height, bool? tunnel, bool? fit}) Future<int>
Release current texture then create a new one for current media, and update textureId.
waitFor(PlaybackState state, {int timeout = -1}) bool
Wait for state in current thread

Operators

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