java.lang.Object
nl.colorize.multimedialib.renderer.teavm.TeaAudio
All Implemented Interfaces:
Audio

public class TeaAudio extends Object implements Audio
Plays audio clips using the HTML5 media API that is supported by all modern browsers. Since the <audio> element is loaded asynchronously, playing the audio clip is only possible after the browser has loaded the audio clip.

Supported audio formats depend on the browser. All browsers support OGG. Older Firefox versions used to not support MP3, but this is now changes and all browsers now also support MP3.

  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    TeaAudio(nl.colorize.util.Subscribable<org.teavm.jso.dom.html.HTMLAudioElement> audioPromise)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    play(int volume, boolean loop)
    Starts playing this audio clip.
    void
    Stops playback of this audio clip and resets the playhead to the start of the audio clip.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface nl.colorize.multimedialib.stage.Audio

    play
  • Constructor Details

    • TeaAudio

      protected TeaAudio(nl.colorize.util.Subscribable<org.teavm.jso.dom.html.HTMLAudioElement> audioPromise)
  • Method Details

    • play

      public void play(int volume, boolean loop)
      Description copied from interface: Audio
      Starts playing this audio clip. volume is in the range 0-100, where 100 indicates the audio clip's normal volume and 0 indicates the audio clip is muted. Calling this method does nothing if playback of this audio clip is already in progress.
      Specified by:
      play in interface Audio
    • stop

      public void stop()
      Description copied from interface: Audio
      Stops playback of this audio clip and resets the playhead to the start of the audio clip. Calling this method does nothing if this audio clip is not currently playing.
      Specified by:
      stop in interface Audio
    • toString

      public String toString()
      Overrides:
      toString in class Object