Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ZegoMediaPlayer

Hierarchy

  • ZegoMediaPlayer

Implemented by

Index

Methods

enableAccurateSeek

  • Open precise seek and set relevant attributes.

    Call the setting before loading the resource. After setting, it will be valid throughout the life cycle of the media player. For multiple calls to ‘enableAccurateSeek’, the configuration is an overwrite relationship, and each call to ‘enableAccurateSeek’ only takes effect on the resources loaded later.

    Parameters

    • enable: boolean

      Whether to enable accurate seek

    • config: ZegoAccurateSeekConfig

      The property setting of precise seek is valid only when enable is YES.

      Unsupported platform: Web

    Returns Promise<void>

enableAux

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

    Parameters

    • enable: boolean

      Aux audio flag. The default is false.

    Returns Promise<void>

enableRepeat

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

    Parameters

    • enable: boolean

      repeat playback flag. The default is false.

    Returns Promise<void>

getAudioTrackCount

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

    Returns Promise<number>

    The count of audio tracks

    Unsupported platform: Web

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. The unit is millisecond

    Unsupported platform: Web

getCurrentState

  • Get the current state of mediaplayer.

    Returns Promise<ZegoMediaPlayerState>

    Current state

    Unsupported platform: Web

getIndex

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

    Returns number

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.

    Unsupported platform: Web

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 play volume

    Unsupported platform: Web

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 play volume

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>

    Total duration. The unit is millisecond

loadResource

  • Load media resource.

    Yon can pass the absolute path of the local resource or the URL of the network resource

    Parameters

    • path: string

      the absolute path of the local resource or the URL of the network resource

    Returns Promise<ZegoMediaPlayerLoadResourceResult>

    the result of calling this API

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.

      Unsupported platform: Web

    Returns Promise<void>

off

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

    Type parameters

    Parameters

    • event: MediaPlayerEventType

      event type

    • Optional callback: ZegoMediaPlayerListener[MediaPlayerEventType]

      callback

      Unsupported platform: Web

    Returns void

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]

      callback

      Unsupported platform: Web

    Returns void

pause

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

    Returns Promise<void>

resume

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

    Returns Promise<void>

seekTo

  • Set the specified playback progress.

    Unit is millisecond

    Parameters

    • millisecond: number

      Point in time of specified playback progress

    Returns Promise<ZegoMediaPlayerSeekToResult>

    the result of calling this API

    Unsupported platform: Web

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 [audioTrackCount].

      Unsupported platform: Web

    Returns Promise<void>

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

    Parameters

    • threshold: number

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

      Unsupported platform: Web

    Returns Promise<void>

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.

      Unsupported platform: Web

    Returns Promise<void>

setPlaySpeed

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

    You should load resource before invoking this function

    Parameters

    • speed: number

      The range is 0.5 ~ 2.0. The default is 1.0.

    Returns Promise<void>

setPlayVolume

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

    Parameters

    • volume: number

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

      Unsupported platform: Web

    Returns Promise<void>

setPlayerView

  • setPlayerView(playerID: number): Promise<void>
  • Set the view of the player playing video.

    Parameters

    • playerID: number

    Returns Promise<void>

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

      Unsupported platform: Web

    Returns Promise<void>

setPublishVolume

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

    Parameters

    • volume: number

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

      Unsupported platform: Web

    Returns Promise<void>

setVoiceChangerParam

  • Setting up the specific voice changer parameters.

    Parameters

    Returns Promise<void>

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>

start

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

    You need to load resources before playing

    Returns Promise<void>

stop

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

    Returns Promise<void>

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

    Returns Promise<ZegoMediaPlayerTakeSnapshotResult>

Generated using TypeDoc