Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.AudioElement


    return (int) (audio.getAudioElement().getVolume() * 100d);
  }

  @Override
  public boolean play() {
    AudioElement elem = audio.getAudioElement();
    elem.pause();
    try {
      // IE9 has been seen to throw an exception here
      elem.setCurrentTime(0);
    } catch (Exception ignore) {
    }
    if (elem.getCurrentTime() != 0) {
      /*
       * Workaround Chrome's inability to play the same audio twice:
       * http://code.google.com/p/chromium/issues/detail?id=71323
       * http://code.google.com/p/chromium/issues/detail?id=75725
       */
      createAudioElement();
    }
    elem.play();
    // best guess is that the sound played, so return true
    return true;
  }
View Full Code Here


      audio.removeFromParent();
    }
    assert Audio.isSupported();
    audio = Audio.createIfSupported();
    assert audio != null;
    AudioElement elem = audio.getAudioElement();
    assert elem != null;

    endedRegistration = audio.addEndedHandler(endedHandler);

    // TODO: remove, once DOM attachment no longer required to sink (bitless) events
    RootPanel.get().add(audio);

    if (isCrossOrigin()) {
      elem.setAttribute("crossOrigin", "anonymous");
    }
    elem.setSrc(getUrl());
  }
View Full Code Here

    return (int) (audio.getAudioElement().getVolume() * 100d);
  }

  @Override
  public boolean play() {
    AudioElement elem = audio.getAudioElement();
    elem.pause();
    try {
      // IE9 has been seen to throw an exception here
      elem.setCurrentTime(0);
    } catch (Exception ignore) {
    }
    if (elem.getCurrentTime() != 0) {
      /*
       * Workaround Chrome's inability to play the same audio twice:
       * http://code.google.com/p/chromium/issues/detail?id=71323
       * http://code.google.com/p/chromium/issues/detail?id=75725
       */
      createAudioElement();
    }
    elem.play();
    // best guess is that the sound played, so return true
    return true;
  }
View Full Code Here

      audio.removeFromParent();
    }
    assert Audio.isSupported();
    audio = Audio.createIfSupported();
    assert audio != null;
    AudioElement elem = audio.getAudioElement();
    assert elem != null;

    endedRegistration = audio.addEndedHandler(endedHandler);

    // TODO: remove, once DOM attachment no longer required to sink (bitless) events
    RootPanel.get().add(audio);

    if (isCrossOrigin()) {
      elem.setAttribute("crossOrigin", "anonymous");
    }
    elem.setSrc(getUrl());
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dom.client.AudioElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.