Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Methods

Abstract clearView

  • clearView(): Promise<void>
  • Clears the last frame of the playback control that remains on the control after playback ends.

    Available since: 2.20.0 Description: Clears the last frame of the playback control that remains on the control after playback ends. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Restrictions: The interface call takes effect only when the media player ends playing.

    Returns Promise<void>

Abstract enableAux

  • enableAux(enable: boolean): Promise<void>
  • Whether to mix the player's sound into the stream being published.

    This interface will only mix the media player sound into the main channel

    Parameters

    • enable: boolean

      Aux audio flag. The default is false.

    Returns Promise<void>

Abstract enableFrequencySpectrumMonitor

  • enableFrequencySpectrumMonitor(enable: boolean, millisecond: number): Promise<void>
  • Whether to enable frequency spectrum monitoring.

    Available since: 2.15.0 Description: Whether to enable frequency spectrum monitoring. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Restrictions: None. Related APIs: After it is turned on, user can use the [onMediaPlayerFrequencySpectrumUpdate] callback to monitor frequency spectrum updates.

    Parameters

    • enable: boolean

      Whether to enable monitoring, true is enabled, false is disabled.

    • millisecond: number

      Monitoring time period of the frequency spectrum, in milliseconds, has a value range of [10, 3000]. Note that on v3.19.0 and older version, the value range is [100, 3000].

    Returns Promise<void>

Abstract enableLiveAudioEffect

  • Enable live audio effect.

    Available since: 3.10.0 Description: When the live audio effect is turned on, the spatial sense is enhanced and the instrument sounds become more prominent, without any increase in delay. Use cases: It is commonly used in voice chat rooms and karaoke scenarios to enhance the live audio effects of the accompaniment. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Caution: To enhance the live audio effect experience, it is recommended to configure dual-channel stereo encoding. Developers can achieve this configuration by using the [setAudioCaptureStereoMode] method. Failure to configure dual-channel stereo encoding may significantly diminish the effects of certain songs, as the left and right channel effects may cancel each other out when synthesizing mono audio, resulting in less noticeable effects.

    Parameters

    Returns Promise<void>

Abstract enableLocalCache

  • enableLocalCache(enable: boolean, cacheDir: string): Promise<void>
  • Enable local caching of http/https network resources.

    Available since: 3.12.0 Description: When playing http/https network resources, when the local cache is enabled, the network resources will be saved locally and the cache information will be called back through [onMediaPlayerLocalCache]. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Called after [loadResource] or during playback, it will take effect next playback. Caution: Only http/https single file type network resources are supported. If there is a [seek] operation during playback, the cache will fail.

    Parameters

    • enable: boolean

      Whether to enable local caching.

    • cacheDir: string

      Cache dir. If left blank, the directory specified internally by SDK will be used.

    Returns Promise<void>

Abstract enableRepeat

  • enableRepeat(enable: boolean): Promise<void>
  • Whether to repeat playback.

    Parameters

    • enable: boolean

      repeat playback flag. The default is false.

    Returns Promise<void>

Abstract enableSoundLevelMonitor

  • enableSoundLevelMonitor(enable: boolean, millisecond: number): Promise<void>
  • Whether to enable sound level monitoring.

    Available since: 2.15.0 Description: Whether to enable sound level monitoring. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Restrictions: None. Related callbacks: After it is turned on, user can use the [onMediaPlayerSoundLevelUpdate] callback to monitor sound level updates.

    Parameters

    • enable: boolean

      Whether to enable monitoring, true is enabled, false is disabled.

    • millisecond: number

      Monitoring time period of the sound level, in milliseconds, has a value range of [100, 3000].

    Returns Promise<void>

Abstract enableViewMirror

  • enableViewMirror(enable: boolean): Promise<void>
  • Enable the view mirror.

    Available since: 3.14.0 Description: Enable view mirror. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].

    Parameters

    • enable: boolean

      Whether to enable view mirror.

    Returns Promise<void>

Abstract enableVoiceChanger

  • Enable voice changer, set up the specific voice changer parameters.

    Available since: 3.15.0 Description: Enable voice changer, set up the specific voice changer parameters. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].

    Parameters

    • audioChannel: ZegoMediaPlayerAudioChannel

      The audio channel to be voice changed

    • enable: boolean

      Whether enable voice changer or not. True - enabled, false - disabled, default value is false.

    • param: ZegoVoiceChangerParam

      Voice changer parameters

    Returns Promise<void>

Abstract getAudioTrackCount

  • getAudioTrackCount(): Promise<number>
  • Get the number of audio tracks of the playback file.

    Returns Promise<number>

    Number of audio tracks

Abstract getCurrentProgress

  • getCurrentProgress(): Promise<number>
  • Get current playing progress.

    You should load resource before invoking this function, otherwise the return value is 0

    Returns Promise<number>

    current progress

Abstract getCurrentRenderingProgress

  • getCurrentRenderingProgress(): Promise<number>
  • Get current rendering progress.

    You should load resource before invoking this function, otherwise the return value is 0

    Returns Promise<number>

    current rendering progress

Abstract getCurrentState

  • Get the current playback status.

    Returns Promise<ZegoMediaPlayerState>

    current state

Abstract getIndex

  • getIndex(): number
  • Get media player index.

    Description: Get media player index. When to call: It can be called after [createMediaPlayer]. Restrictions: None.

    Returns number

    Media player index.

Abstract getMediaInfo

  • Get meida information such as video resolution from media file.

    Available since: 3.6.0 Description: Get meida information such as video resolution from media file. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Restrictions: None.

    Returns Promise<ZegoMediaPlayerMediaInfo>

Abstract getNetWorkResourceCache

  • Get the playable duration and size of the cached data of the current network material cache queue

    Returns Promise<ZegoNetWorkResourceCache>

    Returns the current cached information, including the length of time the data can be played and the size of the cached data.

Abstract getPlayVolume

  • getPlayVolume(): Promise<number>
  • Gets the current local playback volume of the mediaplayer, the range is 0 ~ 200, with the default value of 60.

    Returns Promise<number>

    current volume

Abstract getPlaybackStatistics

  • Get playback statistics.

    Available since: 3.12.0 Description: Get current playback statistics to monitor whether decoding and rendering anomalies occur in the player. Use cases: Typically used in cloud-based media player scenarios. When to call: Invoke after the [loadResource] callback succeeds.

    Returns Promise<ZegoMediaPlayerStatisticsInfo>

Abstract getPublishVolume

  • getPublishVolume(): Promise<number>
  • Gets the current publish volume of the mediaplayer, the range is 0 ~ 200, with the default value of 60.

    Returns Promise<number>

    current volume

Abstract getTotalDuration

  • getTotalDuration(): Promise<number>
  • Get the total progress of your media resources.

    You should load resource before invoking this function, otherwise the return value is 0

    Returns Promise<number>

    Unit is millisecond

Abstract loadResource

  • Load local or network media resource.

    Available: since 1.3.4 Description: Load media resources. Use case: Developers can load the absolute path to the local resource or the URL of the network resource incoming. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Related APIs: Resources can be loaded through the [loadResourceWithPosition] or [loadResourceFromMediaData] function. Caution: If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.

    Parameters

    • path: string

      The absolute resource path or the URL of the network resource and cannot be null or "". Android can set this path string with Uri.

    Returns Promise<ZegoMediaPlayerLoadResourceResult>

    Callback result of loading media resource.

Abstract loadResourceWithConfig

  • Load local or network media resource with config.

    Available: since 3.3.0 Description: Load media resources. Use case: Developers can load the absolute path to the local resource or the URL of the network resource incoming. When to call: Called after the engine [createEngine] has been initialized and the media player [createMediaPlayer] has been created. Related APIs: Support for loading resources through the [loadResourceWithPosition] or [loadResourceFromMediaData] interface. Caution: If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.

    Parameters

    Returns Promise<ZegoMediaPlayerLoadResourceResult>

    Callback result of loading media resource.

Abstract muteLocal

  • muteLocal(mute: boolean): Promise<void>
  • Whether to play locally silently.

    If [enableAux] switch is turned on, there is still sound in the publishing stream. The default is false.

    Parameters

    • mute: boolean

      Mute local audio flag, The default is false.

    Returns Promise<void>

Abstract off

  • off<MediaPlayerEventType>(event: MediaPlayerEventType, callback: undefined | ZegoMediaPlayerListener[MediaPlayerEventType]): void
  • Unregister the event handler of mediaplayer

    Type parameters

    Parameters

    • event: MediaPlayerEventType

      Event type.

    • callback: undefined | ZegoMediaPlayerListener[MediaPlayerEventType]

      Call back.

    Returns void

Abstract on

  • on<MediaPlayerEventType>(event: MediaPlayerEventType, callback: ZegoMediaPlayerListener[MediaPlayerEventType]): void
  • Register the event handler of mediaplayer

    Type parameters

    Parameters

    • event: MediaPlayerEventType

      Event type.

    • callback: ZegoMediaPlayerListener[MediaPlayerEventType]

      Call back.

    Returns void

Abstract pause

  • pause(): Promise<void>
  • Pause playing.

    Returns Promise<void>

Abstract resume

  • resume(): Promise<void>
  • Resume playing.

    Returns Promise<void>

Abstract seekTo

  • Set the specified playback progress.

    Unit is millisecond

    Parameters

    • millisecond: number

      Point in time of specified playback progress

    Returns Promise<ZegoMediaPlayerSeekToResult>

    The result notification of set the specified playback progress

Abstract setActiveAudioChannel

  • Set the playback channel.

    Available since: 2.20.0 Description: Set the playback channel. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Restrictions: None.

    Parameters

    Returns Promise<void>

Abstract setAudioTrackIndex

  • setAudioTrackIndex(index: number): Promise<void>
  • Set the audio track of the playback file.

    Parameters

    • index: number

      Audio track index, the number of audio tracks can be obtained through the [getAudioTrackCount] function.

    Returns Promise<void>

Abstract setAudioTrackMode

  • Set the audio track mode of the player.

    Available since: 3.1.0 Description: Set the audio track mode of the player. Use case: Under the real-time chorus (KTV), call the interface enable multi-track mode, call the interface [setAudioTrackIndex] to specify the original track to play, call interface [setAudioTrackPublishIndex] specified need publish of accompaniment tracks. When to call: The call takes effect before [start] starts playing Related APIs: Call [setAudioTrackIndex] to specified the play track of media file and call [setAudioTrackPublishIndex] to specified the publish track of media file. Caution: When multi-track mode is enabled, the resource consumption of the hardware device is increased.

    Parameters

    Returns Promise<void>

Abstract setAudioTrackPublishIndex

  • setAudioTrackPublishIndex(index: number): Promise<void>
  • Set the audio track for the media file to be publish.

    Available since: 3.1.0 Description: Set the audio track for the media file to be publish. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Related APIs: The number of audio tracks can be obtained through the [getAudioTrackCount] function. Caution: This call takes effect only after multitrack mode is enabled by calling the interface [setAudioTrackMode].

    Parameters

    • index: number

      Audio track index, the number of audio tracks can be obtained through the [getAudioTrackCount] function.

    Returns Promise<void>

Abstract setHttpHeader

  • setHttpHeader(headers: Record<string, string>): Promise<void>
  • Set http headers.

    Available since: 3.8.0 Description: Call this function to set the http headers of the http network resource. Use cases: When the network resource needs to set special header information. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Restrictions: Called before the corresponding network resource is loaded.

    Parameters

    • headers: Record<string, string>

      Headers info.

    Returns Promise<void>

Abstract setNetWorkBufferThreshold

  • setNetWorkBufferThreshold(threshold: number): Promise<void>
  • Use this interface to set the cache threshold that the media player needs to resume playback. The SDK default value is 5000ms,The valid value is greater than or equal to 1000ms

    The setting must be called before loading the resource, and it will take effect during the entire life cycle of the media player. When the network status is poor and the media player has finished playing the cached network resources, it will stop playing, and notify the user through the ZegoMediaPlayerNetworkEvent.BUFFER_BEGIN state of the callback interface onMediaPlayerNetworkEvent that the network resources are being recached. Only when the cached network resources are greater than the set threshold, the media player will automatically resume playback at the original paused position, and notify the user through the ZegoMediaPlayerNetworkEvent.BUFFER_ENDED of the callback interface onMediaPlayerNetworkEvent that the user has cached the network resources The threshold was reached and playback resumed.

    Parameters

    • threshold: number

      Threshold that needs to be reached to resume playback, unit ms.

    Returns Promise<void>

Abstract setNetWorkResourceMaxCache

  • setNetWorkResourceMaxCache(time: number, size: number): Promise<void>
  • Set the maximum cache duration and cache data size of web materials.

    The setting must be called before loading the resource, and it will take effect during the entire life cycle of the media player. Time and size are not allowed to be 0 at the same time. The SDK internal default time is 5000, and the size is 1510241024 byte.When one of time and size reaches the set value first, the cache will stop.

    Parameters

    • time: number

      The maximum length of the cache time, in ms, the SDK internal default is 5000; the effective value is greater than or equal to 2000; if you fill in 0, it means no limit.

    • size: number

      The maximum size of the cache, the unit is byte, the internal default size of the SDK is 1510241024 byte; the effective value is greater than or equal to 5000000, if you fill in 0, it means no limit.

    Returns Promise<void>

Abstract setPlayMediaStreamType

  • Set play media stream type.

    Available since: 3.10.0 Description: Configure the media stream type to be played. You can only play video streams or audio streams. This will take effect during the life cycle of the media player. Use cases: When only the video stream or audio stream needs to be played. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Caution: Changing the media stream type during playing will take effect in the next playing.

    Parameters

    Returns Promise<void>

Abstract setPlaySpeed

  • setPlaySpeed(speed: number): Promise<void>
  • Set the speed of play.

    Available since: 2.12.0 Description: Set the playback speed of the player. When to call: You should load resource before invoking this function. Restrictions: None. Related APIs: Resources can be loaded through the [loadResource] function.

    Parameters

    • speed: number

      The speed of play. The default is 1.0. Versions 2.12.0 to 3.15.1: The range is 0.5 ~ 4.0. Versions 3.16.0 and above: The range is 0.3 ~ 4.0.

    Returns Promise<void>

Abstract setPlayVolume

  • setPlayVolume(volume: number): Promise<void>
  • Set mediaplayer local playback volume.

    Parameters

    • volume: number

      The range is 0 ~ 200. The default is 60.

    Returns Promise<void>

Abstract setPlayerView

  • setPlayerView(view: ZegoView): Promise<void>
  • Set the view of the player playing video. Note: This function is only available in ZegoExpressVideo SDK!

    Parameters

    • view: ZegoView

      Video rendered canvas object

    Returns Promise<void>

Abstract setProgressInterval

  • setProgressInterval(millisecond: number): Promise<void>
  • Set playback progress callback interval.

    This function can control the callback frequency of [onMediaPlayerPlayingProgress]. When the callback interval is set to 0, the callback is stopped. The default callback interval is 1s This callback are not returned exactly at the set callback interval, but rather at the frequency at which the audio or video frames are processed to determine whether the callback is needed to call

    Parameters

    • millisecond: number

      Interval of playback progress callback in milliseconds

    Returns Promise<void>

Abstract setPublishVolume

  • setPublishVolume(volume: number): Promise<void>
  • Set mediaplayer publish volume.

    Parameters

    • volume: number

      The range is 0 ~ 200. The default is 60.

    Returns Promise<void>

Abstract setVolume

  • setVolume(volume: number): Promise<void>
  • Set mediaplayer volume. Both the local play volume and the publish volume are set.

    Parameters

    • volume: number

      The range is 0 ~ 200. The default is 60.

    Returns Promise<void>

Abstract start

  • start(): Promise<void>
  • Start playing.

    You need to load resources before playing

    Returns Promise<void>

Abstract stop

  • stop(): Promise<void>
  • Stop playing.

    Returns Promise<void>

Abstract takeSnapshot

  • Take a screenshot of the current playing screen of the media player.

    Only in the case of calling [setPlayerCanvas] to set the display controls and the playback state, can the screenshot be taken normally Note: This function is only available in ZegoExpressVideo SDK!

    Returns Promise<ZegoMediaPlayerTakeSnapshotResult>

Abstract updatePosition

  • updatePosition(position: number[]): Promise<void>
  • Update the position of the media player (audio source).

    Available since: 3.6.0 Description: Update the position of the media player (audio source). Use cases: The media player also needs to have 3D spatial sound. When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Restrictions: This interface needs to be used in conjunction with the RangeAudio/RangeScene module. This interface can only be called successfully after the RangeAudio/RangeScene module enables 3D sound effects.

    Parameters

    • position: number[]

      The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3.

    Returns Promise<void>

Generated using TypeDoc