Package org.zkoss.zul

Class Audio

    • Field Detail

      • STOP

        public static final int STOP
        Represent the stop state
        Since:
        9.6.0
        See Also:
        Constant Field Values
      • PLAY

        public static final int PLAY
        Represent the play state
        Since:
        9.6.0
        See Also:
        Constant Field Values
      • PAUSE

        public static final int PAUSE
        Represent the pause state
        Since:
        9.6.0
        See Also:
        Constant Field Values
      • _src

        protected java.util.List<java.lang.String> _src
    • Constructor Detail

      • Audio

        public Audio()
      • Audio

        public Audio​(java.lang.String src)
    • Method Detail

      • play

        public void play()
        Plays the audio at the client.
      • stop

        public void stop()
        Stops the audio at the client, and reset its currentTime to zero. (i.e. reset to begin)
      • pause

        public void pause()
        Pauses the audio at the client.
      • getSrc

        public java.util.List<java.lang.String> getSrc()
        Returns the src.

        Default: [].

      • setSrc

        public void setSrc​(java.util.List<java.lang.String> src)
        Sets the source list.
        Since:
        7.0.0
      • isAutoplay

        public boolean isAutoplay()
        Returns whether to auto start playing the audio.

        Default: false.

        Since:
        7.0.0
      • setAutoplay

        public void setAutoplay​(boolean autoplay)
        Sets whether to auto start playing the audio.
        Since:
        7.0.0
      • getPreload

        public java.lang.String getPreload()
        Returns whether and how the audio should be loaded. "none" or "metadata" or "auto" or null

        Default: null.

        Since:
        7.0.0
      • setPreload

        public void setPreload​(java.lang.String preload)
        Sets whether and how the audio should be loaded. Refer to Preload Attribute Description for details.
        Parameters:
        preload - which could be one of "none", "metadata", "auto".
        Since:
        7.0.0
      • isControls

        public boolean isControls()
        Returns whether to display the audio controls.

        Default: false.

        Since:
        7.0.0
      • setControls

        public void setControls​(boolean controls)
        Sets whether to display the audio controls.
        Since:
        7.0.0
      • isLoop

        public boolean isLoop()
        Returns whether to play the audio repeatedly.

        Default: false.

        Since:
        3.6.1
      • setLoop

        public void setLoop​(boolean loop)
        Sets whether to play the audio repeatedly.
        Since:
        3.6.1
      • isMuted

        public boolean isMuted()
        Returns whether to mute the audio.

        Default: false.

        Since:
        7.0.0
      • setMuted

        public void setMuted​(boolean muted)
        Sets whether to mute the audio.
        Since:
        7.0.0
      • isPlaying

        public boolean isPlaying()
        Return whether the audio is playing.
        Returns:
        true if audio is playing;
        Since:
        9.6.0
      • isPaused

        public boolean isPaused()
        Return whether the audio is paused.
        Returns:
        true if audio is paused;
        Since:
        9.6.0
      • isStopped

        public boolean isStopped()
        Return whether the audio is stopped. While the audio is ended, also means it is stopped.
        Returns:
        true if audio is stopped or ended;
        Since:
        9.6.0
      • isEnded

        public boolean isEnded()
        Return whether the audio is ended.
        Returns:
        true if audio is ended;
        Since:
        9.6.0