Java 类com.google.gwt.dom.client.MediaElement 实例源码

项目:GWT-AL    文件:AudioDecoder.java   
public static boolean isSupported(FileFormat format)
{
    if (tempAudioElement == null)
        tempAudioElement = Document.get().createAudioElement();

    switch (format)
    {
        case MP3:
            return !tempAudioElement.canPlayType(AudioElement.TYPE_MP3).equals(MediaElement.CANNOT_PLAY);

        case WAV:
            return !tempAudioElement.canPlayType(AudioElement.TYPE_WAV).equals(MediaElement.CANNOT_PLAY);

        case OGG:
            return !tempAudioElement.canPlayType(AudioElement.TYPE_OGG).equals(MediaElement.CANNOT_PLAY);

        case WEBM:
            return !tempAudioElement.canPlayType("audio/webm").equals(MediaElement.CANNOT_PLAY);
    }

    return false;
}
项目:empiria.player    文件:HTML5VideoImpl.java   
public HTML5VideoImpl() {
    video = eu.ydp.empiria.player.client.media.Video.createIfSupported();
    video.setPreload(MediaElement.PRELOAD_METADATA);
    video.setLoop(false);
    add(video);

}
项目:empiria.player    文件:HTML5VideoMediaWrapperJUnitTest.java   
@Test
public void canPlayTest_MediaObjectWasChange() {
    eventsBus.fireEventFromSource(new MediaEvent(MediaEventTypes.ON_DURATION_CHANGE, instance), instance);
    assertTrue(instance.canPlay());

    when(video.getMedia().getReadyState()).thenReturn(MediaElement.HAVE_NOTHING);
    instance.setMediaObject(video.getMedia());
    assertFalse(instance.canPlay());
}
项目:ns2gather    文件:SoundManager.java   
public SoundManager() {
    for (String soundURL : soundURLs) {
        Audio newAudio = Audio.createIfSupported();
        if (newAudio == null) {
            throw new AlertRuntimeException("Браузер не поддерживает звуки (HTML5 элемент <audio>)");
        }
        newAudio.setPreload(MediaElement.PRELOAD_AUTO);
        newAudio.setSrc("audio/" + soundURL);
        newAudio.setAutoplay(false);
        audios.add(newAudio);
    }
}
项目:empiria.player    文件:AbstractHTML5MediaWrapper.java   
private void setMediaBaseAndPreload(MediaBase mediaBase) {
    this.mediaBase = mediaBase;
    this.ready = false;
    mediaBase.setPreload(MediaElement.PRELOAD_METADATA);
}
项目:empiria.player    文件:AbstractHTML5MediaWrapper.java   
@Override
public boolean canPlay() {
    return ready || mediaBase.getReadyState() != MediaElement.HAVE_NOTHING;
}
项目:empiria.player    文件:HTML5AudioMediaExecutor.java   
@Override
protected String getMediaPreloadType() {
    return MediaElement.PRELOAD_AUTO;
}
项目:empiria.player    文件:AbstractHTML5MediaExecutor.java   
protected String getMediaPreloadType() {
    return MediaElement.PRELOAD_METADATA;
}
项目:empiria.player    文件:HTML5VideoMediaWrapperJUnitTest.java   
@Test
public void canPlayTest_MediaReadyStateHaveNothing() {
    when(video.getMedia().getReadyState()).thenReturn(MediaElement.HAVE_NOTHING);
    assertFalse(instance.canPlay());
}
项目:empiria.player    文件:HTML5VideoMediaWrapperJUnitTest.java   
@Test
public void canPlayTest_MediaReadyStateHaveData() {
    when(video.getMedia().getReadyState()).thenReturn(MediaElement.HAVE_ENOUGH_DATA);
    assertTrue(instance.canPlay());
}
项目:empiria.player    文件:HTML5AudioMediaExecutorJUnitTest.java   
@Override
public String getAssumedMediaPreloadType() {
    return MediaElement.PRELOAD_AUTO;
}
项目:empiria.player    文件:AbstractHTML5MediaExecutorJUnitBase.java   
protected String getAssumedMediaPreloadType() {
    return MediaElement.PRELOAD_METADATA;
}
项目:GWT-AL    文件:AudioContext.java   
public native MediaElementAudioSourceNode createMediaElementSource(MediaElement mediaElement) /*-{
    return this.createMediaElementSource(mediaElement);
}-*/;