VodPlayerFlutter class
Properties
currentResolution
→ Future <TTVideoEngineResolutionType >
Resolution === begin
When playing with a VideoID video source, the server will send down multiple playback addresses of different resolutions.
When the TTVideoEngine receives the fetchedVideoModel callback, you can call the supportedResolutionTypes method to obtain an array of all resolutions. You can use this array for displaying the resolution list and for the logic of selecting clarity.
Retrieve video clarity information, which should be obtained after onPrepared.
no setter
didFinish
↔ void Function(TTError ? error ) ?
play did finish
getter/setter pair
duration
→ Future <Duration >
no setter
engineInstanceEventChannel
↔ EventChannel
late final
engineInstanceMethodChannel
↔ MethodChannel
late final
fetchedVideoModel
↔ void Function() ?
The video has obtained a list of resolutions, which can be used for displaying the resolution list.
getter/setter pair
hashCode
→ int
The hash code for this object.
no setter inherited
isHardwareDecode
→ Future <bool >
Check if the current playback is hardware-accelerated, it should be called after onPrepared.
no setter
loadStateDidChanged
↔ void Function(TTVideoEngineLoadState loadState , ) ?
load State Change
getter/setter pair
looping
→ Future <bool >
no setter
onPrepared
↔ void Function() ?
getter/setter pair
onSubtitleFileLoadResult
↔ void Function(bool success ) ?
subtitle file load result callback
getter/setter pair
onSubtitleSelected
↔ void Function(bool success , int subtitleId ) ?
subtitle selected callback
getter/setter pair
onSubtitlesFetched
↔ void Function(bool success , List <TTSubtitle > ? subtitles , TTError ? error ) ?
vid source subtitle path info fetched callback
getter/setter pair
onSubtitleShow
↔ void Function(String ? content , int pts , int duration ) ?
subtitle frame update update callback
getter/setter pair
playableDuration
→ Future <Duration >
Buffered playback duration.
no setter
playbackStateDidChanged
↔ void Function(TTVideoEnginePlaybackState playbackState ) ?
Playback State Change
getter/setter pair
position
→ Future <Duration >
no setter
readyToDisplay
↔ void Function() ?
video first frame rendered
getter/setter pair
resolutionConfigCompletion
↔ void Function(bool success , TTVideoEngineResolutionType completeResolution ) ?
switch resolution finish
getter/setter pair
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
supportedResolutionTypes
→ Future <List <TTVideoEngineResolutionType > >
Retrieve the array of video resolutions.
no setter
videoHeight
→ Future <int >
no setter
videoWidth
→ Future <int >
Get the video width/height, it should be obtained after onPrepared.
no setter
Methods
closeAsync ()
→ Future <void >
configResolutionAfterStart ({required TTVideoEngineResolutionType targetResolution , void completion (bool success , TTVideoEngineResolutionType completeResolution )? })
→ Future <void >
Set the initial playback clarity: Preset the clarity information before playing. If there is no corresponding clarity level, it will automatically downgrade and traverse the list of supported clarity to find a suitable level.
configResolutionBeforeStart (TTVideoEngineResolutionType resolution )
→ Future <void >
设置起播的清晰度:在播放之前预设值清晰度信息,如果没有对应的清晰度档位,会自动降级遍历支持清晰度列表,查找合适的清晰度档位
createPlayer ({String ? vid , bool preCreated = false })
→ Future <String >
Create a Native player, it is recommended to call this first, immediately after the constructor.
forceDraw ()
→ Future <void >
Force refresh surface with last frame. Android only.
getDoubleOption (int key )
→ Future <double ? >
getIntOption (int key )
→ Future <int ? >
getLongOption (int key )
→ Future <int ? >
getOption <T > (int key )
→ Future <T? >
getPlaybackState ()
→ Future <TTVideoEnginePlaybackState >
getStringOption (int key )
→ Future <String ? >
getVolume ()
→ Future <TTVolume ? >
get volume
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openTextureRender (bool open )
→ Future <void >
enable TextureRender
pause ()
→ Future <void >
play ()
→ Future <void >
seekToTimeMs ({required double time , void seekCompleted (bool )?, void seekRenderCompleted ()? })
→ Future <void >
seek to time.
setClipToBounds (bool clip )
→ Future <void >
mute default is NO , only for iOS
Set custom HTTP Header in the playback request.
setHardwareDecode (bool isHardwareDecode )
→ Future <void >
Set hardware decoding, the default value is true, it needs to be set before calling play().
setHLSMultiBitrateConfig ({void getHlsStreamInfos (TTMasterPlaylist playlist )?, int ? selectHlsVideoStream ()?, int ? selectHlsRendition (int variantIndex )?, void switchHlsVideoBitrate (int bitrate )? })
→ Future <void >
resolution === end
master-m3u8 === begin
setLooping (bool looping )
→ Future <void >
set loop play
setMediaSource (TTVideoEngineMediaSource source )
→ Future <void >
set play source
setMirrorHorizontal (bool mirror )
→ Future <void >
Set horizontal mirroring.
setMirrorVertical (bool mirror )
→ Future <void >
Set vertical mirroring.
setMuted (bool muted )
→ Future <void >
mute
setOption <T > (int key , T value )
→ Future <void >
master-m3u8 === end
Call after createPlayer().
T valid types: bool, int, string, double
setPlaybackSpeed (double speed )
→ Future <void >
Set the playback speed, with a value range of 0.1 to 3.0.
setPlayerContainerView (int viewId )
→ Future <void >
Set the player's ContainerView, pass in TTVideoPlayerView.viewId.
@see class TTVideoPlayerView
setRadioMode (bool radioMode )
→ Future <void >
only audio playback.
setRotation (int angle )
→ Future <void >
rotate
setScalingMode (TTVideoEngineScalingMode mode )
→ Future <void >
set video scale mode
setSelectedSubtitle (int subtitleId )
→ Future <void >
setStartTimeMs (double startTime )
→ Future <void >
Set the starting playback position, unit: milliseconds.
setSubTag (String subTag )
→ Future <void >
Custom tag "subtag" is used to differentiate between different subdivisions within the same business type, such as encrypted videos, non-encrypted videos, audios, etc.
setSubtitleAuthToken (String subtitleAuthToken )
→ Future <void >
setSubtitleEnabled (bool enabled )
→ Future <void >
setSubtitles (List <TTSubtitle > subtitles )
→ Future <void >
setSubtitleShow (bool show )
→ Future <void >
setTag (String tag )
→ Future <void >
Business type (tag) is used to distinguish different types of audio and video within the same application (appid). It can be divided according to business needs based on video scenarios, video duration, etc.: such as immersive feed streams, short videos, long videos, etc.
setTrackVolumeEnabled (bool isEnabled )
→ Future <void >
setUrlSource (TTVideoEngineUrlSource source )
→ Future <void >
setVidSource (TTVideoEngineVidSource source )
→ Future <void >
setVolume ({required TTVolume volume })
→ Future <void >
set volume
@Note: In iOS, the volume of the left and right audio channels is consistent; when there is a discrepancy, iOS takes the value of the left channel.
stop ()
→ Future <void >
switchHlsAudioRendition ({required dynamic auidoInfoId })
→ Future <void >
Switching audio tracks during HLS playback, if the passed audioInfoId does not exist, do not switch.
switchHlsVideoBitrate ({required int bitrate })
→ Future <void >
Switching HLS video quality during playback, if the passed bitrate level does not exist, select the closest available quality level.
toString ()
→ String
A string representation of this object.
inherited