Class ZegoAudioEffectPlayerInternalImpl

    • Field Detail

      • mUIHandler

        public static android.os.Handler mUIHandler
      • audioEffectPlayerToIdxAndEventhandler

        public static java.util.concurrent.ConcurrentHashMap<ZegoAudioEffectPlayer,​im.zego.zegoexpress.internal.ZegoAudioEffectPlayerInternalImpl.IdxAndHandler> audioEffectPlayerToIdxAndEventhandler
    • Constructor Detail

      • ZegoAudioEffectPlayerInternalImpl

        public ZegoAudioEffectPlayerInternalImpl()
    • Method Detail

      • destroyAudioEffectPlayer

        public static void destroyAudioEffectPlayer​(ZegoAudioEffectPlayer audioEffectPlayer)
      • destroyAllAudioEffectPlayer

        public static void destroyAllAudioEffectPlayer()
      • setEventHandler

        public void setEventHandler​(IZegoAudioEffectPlayerEventHandler handler)
        Description copied from class: ZegoAudioEffectPlayer
        Set audio effect player event handler. Available since: 1.16.0 Description: Set audio effect player event handler. When to call: It can be called after [createAudioEffectPlayer]. Restrictions: None. Related APIs: [createAudioEffectPlayer].
        Specified by:
        setEventHandler in class ZegoAudioEffectPlayer
        Parameters:
        handler - event handler for audio effect player.
      • loadResource

        public void loadResource​(int audioEffectID,
                                 java.lang.String path,
                                 IZegoAudioEffectPlayerLoadResourceCallback callback)
        Description copied from class: ZegoAudioEffectPlayer
        Load audio effect resource. In a scene where the same sound effect is played frequently, the SDK provides the function of preloading the sound effect file into the memory in order to optimize the performance of repeatedly reading and decoding the file. Preloading supports loading up to 15 sound effect files at the same time, and the duration of the sound effect files cannot exceed 30s, otherwise an error will be reported when loading Android developers can pass parameters through Uri, namely:String path = uri.toString();
        Specified by:
        loadResource in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
        path - the absolute path of the audio effect resource and cannot be null or "".
        Value range: "assets://"、"ipod-library://" and network url are not supported.
        callback - load audio effect resource result.
      • unloadResource

        public void unloadResource​(int audioEffectID)
        Description copied from class: ZegoAudioEffectPlayer
        Unload audio effect resource. Available since: 1.16.0 Description: Unload the specified audio effect resource. When to call: After the sound effects are used up, related resources can be released through this function; otherwise, the SDK will release the loaded resources when the AudioEffectPlayer instance is destroyed. Restrictions: None. Related APIs: [loadResource].
        Specified by:
        unloadResource in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect loaded.
      • updatePosition

        public void updatePosition​(int audioEffectID,
                                   float[] position)
        Description copied from class: ZegoAudioEffectPlayer
        Update the position of the audio effect player (audio source). Available since: 3.6.0 Description: Update the position of the audio effect player (audio source). Use cases: The audio effect player also needs to have 3D spatial sound. When to call: Listen to the [onAudioEffectPlayStateUpdate] callback, please call this interface after the player state is ZegoAudioEffectPlayState.Playing and before ZegoAudioEffectPlayState.NoPlay/PlayEnded. 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.
        Specified by:
        updatePosition in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
        position - The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3.
      • start

        public void start​(int audioEffectID,
                          java.lang.String path,
                          ZegoAudioEffectPlayConfig config)
        Description copied from class: ZegoAudioEffectPlayer
        Start playing audio effect. Available since: 1.16.0 Description: Start playing audio effect. The default is only played once and is not mixed into the publishing stream, if you want to change this please modify [config] param. Use cases: When you need to play short sound effects, such as applause, cheers, etc., you can use this interface to achieve, and further configure the number of plays through the [config] parameter, and mix the sound effects into the push stream. When to call: It can be called after [createAudioEffectPlayer]. Restrictions: None.
        Specified by:
        start in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - Description: ID for the audio effect. The SDK uses audioEffectID to control the playback of sound effects. The SDK does not force the user to pass in this parameter as a fixed value. It is best to ensure that each sound effect can have a unique ID. The recommended methods are static self-incrementing ID or the hash of the incoming sound effect file path.
        path - The absolute path of the local resource.
        Value range: "assets://"、"ipod-library://" and network url are not supported. Set path as null or "" if resource is loaded already using [loadResource].
        config - Audio effect playback configuration.
        Default value: Set null will only be played once, and will not be mixed into the publishing stream.
      • stop

        public void stop​(int audioEffectID)
        Description copied from class: ZegoAudioEffectPlayer
        Stop playing audio effect. Available since: 1.16.0 Description: Stop playing the specified audio effect [audioEffectID]. When to call: The specified [audioEffectID] is [start]. Restrictions: None.
        Specified by:
        stop in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
      • pause

        public void pause​(int audioEffectID)
        Description copied from class: ZegoAudioEffectPlayer
        Pause playing audio effect. Available since: 1.16.0 Description: Pause playing the specified audio effect [audioEffectID]. When to call: The specified [audioEffectID] is [start]. Restrictions: None.
        Specified by:
        pause in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
      • resume

        public void resume​(int audioEffectID)
        Description copied from class: ZegoAudioEffectPlayer
        Resume playing audio effect. Available since: 1.16.0 Description: Resume playing the specified audio effect [audioEffectID]. When to call: The specified [audioEffectID] is [pause]. Restrictions: None.
        Specified by:
        resume in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
      • stopAll

        public void stopAll()
        Description copied from class: ZegoAudioEffectPlayer
        Stop playing all audio effect. Available since: 1.16.0 Description: Stop playing all audio effect. When to call: Some audio effects are Playing. Restrictions: None.
        Specified by:
        stopAll in class ZegoAudioEffectPlayer
      • pauseAll

        public void pauseAll()
        Description copied from class: ZegoAudioEffectPlayer
        Pause playing all audio effect. Available since: 1.16.0 Description: Pause playing all audio effect. When to call: It can be called after [createAudioEffectPlayer]. Restrictions: None.
        Specified by:
        pauseAll in class ZegoAudioEffectPlayer
      • resumeAll

        public void resumeAll()
        Description copied from class: ZegoAudioEffectPlayer
        Resume playing all audio effect. Available since: 1.16.0 Description: Resume playing all audio effect. When to call: It can be called after [pauseAll]. Restrictions: None.
        Specified by:
        resumeAll in class ZegoAudioEffectPlayer
      • seekTo

        public void seekTo​(int audioEffectID,
                           long millisecond,
                           IZegoAudioEffectPlayerSeekToCallback callback)
        Description copied from class: ZegoAudioEffectPlayer
        Set the specified playback progress. Available since: 1.16.0 Description: Set the specified audio effect playback progress. Unit is millisecond. When to call: The specified [audioEffectID] is[start], and not finished. Restrictions: None.
        Specified by:
        seekTo in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
        millisecond - Point in time of specified playback progress.
        callback - The result of seek.
      • setVolume

        public void setVolume​(int audioEffectID,
                              int volume)
        Description copied from class: ZegoAudioEffectPlayer
        Set volume for a single audio effect. Both the local play volume and the publish volume are set. Available since: 1.16.0 Description: Set volume for a single audio effect. Both the local play volume and the publish volume are set. When to call: The specified [audioEffectID] is [start]. Restrictions: None.
        Specified by:
        setVolume in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
        volume - Volume.
        Value range: The range is 0 ~ 200.
        Default value: The default is 100.
      • setPlayVolume

        public void setPlayVolume​(int audioEffectID,
                                  int volume)
        Description copied from class: ZegoAudioEffectPlayer
        Set local play volume for a single audio effect. Available since: 3.11.0 Description: Set local play volume for a single audio effect. When to call: The specified [audioEffectID] is [start]. Restrictions: None.
        Specified by:
        setPlayVolume in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
        volume - Volume.
        Value range: The range is 0 ~ 200.
        Default value: The default is 100.
      • setPublishVolume

        public void setPublishVolume​(int audioEffectID,
                                     int volume)
        Description copied from class: ZegoAudioEffectPlayer
        Set publish volume for a single audio effect. Available since: 3.11.0 Description: Set publish volume for a single audio effect. When to call: The specified [audioEffectID] is [start]. Restrictions: None.
        Specified by:
        setPublishVolume in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
        volume - Volume.
        Value range: The range is 0 ~ 200.
        Default value: The default is 100.
      • setVolumeAll

        public void setVolumeAll​(int volume)
        Description copied from class: ZegoAudioEffectPlayer
        Set volume for all audio effect. Both the local play volume and the publish volume are set. Available since: 1.16.0 Description: Set volume for all audio effect. Both the local play volume and the publish volume are set. When to call: It can be called after [createAudioEffectPlayer]. Restrictions: None.
        Specified by:
        setVolumeAll in class ZegoAudioEffectPlayer
        Parameters:
        volume - Volume.
        Value range: The range is 0 ~ 200.
        Default value: The default is 100.
      • setPlayVolumeAll

        public void setPlayVolumeAll​(int volume)
        Description copied from class: ZegoAudioEffectPlayer
        Set local play volume for all audio effect. Available since: 3.11.0 Description: Set local play volume for all audio effect. When to call: It can be called after [createAudioEffectPlayer]. Restrictions: None.
        Specified by:
        setPlayVolumeAll in class ZegoAudioEffectPlayer
        Parameters:
        volume - Volume.
        Value range: The range is 0 ~ 200.
        Default value: The default is 100.
      • setPublishVolumeAll

        public void setPublishVolumeAll​(int volume)
        Description copied from class: ZegoAudioEffectPlayer
        Set publish volume for all audio effect. Available since: 3.11.0 Description: Set publish volume for all audio effect. When to call: It can be called after [createAudioEffectPlayer]. Restrictions: None.
        Specified by:
        setPublishVolumeAll in class ZegoAudioEffectPlayer
        Parameters:
        volume - Volume.
        Value range: The range is 0 ~ 200.
        Default value: The default is 100.
      • setPlaySpeed

        public void setPlaySpeed​(int audioEffectID,
                                 float speed)
        Description copied from class: ZegoAudioEffectPlayer
        Set the playback speed for a given audio effect. Both the local play speed and the publish speed are set. (separate settings are not supported). Available since: 2.18.0 Description: Set the playback speed for a given audio effect. Both the local play speed and the publish speed are set. (separate settings are not supported). When to call: The specified [audioEffectID] is [start]. Restrictions: None.
        Specified by:
        setPlaySpeed in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
        speed - The speed of play.
        Value range: The range is 0.5 ~ 2.0.
        Default value: The default is 1.0.
      • getTotalDuration

        public long getTotalDuration​(int audioEffectID)
        Description copied from class: ZegoAudioEffectPlayer
        Get the total duration of the specified audio effect resource. Available since: 1.16.0 Description: Get the total duration of the specified audio effect resource. Unit is millisecond. When to call: You should invoke this function after the audio effect resource already loaded, otherwise the return value is 0. Restrictions: It can be called after [createAudioEffectPlayer]. Related APIs: [start], [loadResource].
        Specified by:
        getTotalDuration in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
        Returns:
        Unit is millisecond.
      • getCurrentProgress

        public long getCurrentProgress​(int audioEffectID)
        Description copied from class: ZegoAudioEffectPlayer
        Get current playback progress. Available since: 1.16.0 Description: Get current playback progress of the specified audio effect. Unit is millisecond. When to call: You should invoke this function after the audio effect resource already loaded, otherwise the return value is 0. Restrictions: None. Related APIs: [start], [loadResource].
        Specified by:
        getCurrentProgress in class ZegoAudioEffectPlayer
        Parameters:
        audioEffectID - ID for the audio effect.
      • getIndex

        public int getIndex()
        Description copied from class: ZegoAudioEffectPlayer
        Get audio effect player index. Available since: 1.16.0 Description: Get audio effect player index. When to call: It can be called after [createAudioEffectPlayer]. Restrictions: None.
        Specified by:
        getIndex in class ZegoAudioEffectPlayer
        Returns:
        Audio effect player index.