All Downloads are FREE. Search and download functionalities are using the official Maven repository.

elemental.html.MediaElement Maven / Gradle / Ivy

/*
 * Copyright 2012 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package elemental.html;
import elemental.dom.Element;
import elemental.events.EventListener;

import elemental.events.*;
import elemental.util.*;
import elemental.dom.*;
import elemental.html.*;
import elemental.css.*;
import elemental.stylesheets.*;

import java.util.Date;

/**
  * HTML media elements (such as <audio>
 and <video>
) expose the HTMLMediaElement interface which provides special properties and methods (beyond the regular element object interface they also have available to them by inheritance) for manipulating the layout and presentation of media elements.
  */
public interface MediaElement extends Element {

    static final int EOS_DECODE_ERR = 2;

    static final int EOS_NETWORK_ERR = 1;

    static final int EOS_NO_ERROR = 0;

  /**
    * Data is available for the current playback position, but not enough to actually play more than one frame.
    */

    static final int HAVE_CURRENT_DATA = 2;

  /**
    * Enough data is available—and the download rate is high enough—that the media can be played through to the end without interruption.
    */

    static final int HAVE_ENOUGH_DATA = 4;

  /**
    * Data for the current playback position as well as for at least a little bit of time into the future is available (in other words, at least two frames of video, for example).
    */

    static final int HAVE_FUTURE_DATA = 3;

  /**
    * Enough of the media resource has been retrieved that the metadata attributes are initialized.  Seeking will no longer raise an exception.
    */

    static final int HAVE_METADATA = 1;

  /**
    * No information is available about the media resource.
    */

    static final int HAVE_NOTHING = 0;

    static final int NETWORK_EMPTY = 0;

    static final int NETWORK_IDLE = 1;

    static final int NETWORK_LOADING = 2;

    static final int NETWORK_NO_SOURCE = 3;

    static final int SOURCE_CLOSED = 0;

    static final int SOURCE_ENDED = 2;

    static final int SOURCE_OPEN = 1;


  /**
    * Reflects the 

autoplay
 HTML attribute, indicating whether to begin playing as soon as enough media is available.
    */
  boolean isAutoplay();

  void setAutoplay(boolean arg);


  /**
    * The ranges of the media source that the browser has buffered, if any.
    */
  TimeRanges getBuffered();

  MediaController getController();

  void setController(MediaController arg);


  /**
    * Reflects the 

controls
 HTML attribute, indicating whether user interface items for controlling the resource should be displayed.
    */
  boolean isControls();

  void setControls(boolean arg);


  /**
    * The absolute URL of the chosen media resource (if, for example, the server selects a media file based on the resolution of the user's display), or an empty string if the networkState is EMPTY.
    */
  String getCurrentSrc();


  /**
    * The current playback time, in seconds.  Setting this value seeks the media to the new time.
    */
  float getCurrentTime();

  void setCurrentTime(float arg);


  /**
    * Reflects the 

muted
 HTML attribute, indicating whether the media element's audio output should be muted by default. Changing the value dynamically will not unmute the audio (it only controls the default state).
    */
  boolean isDefaultMuted();

  void setDefaultMuted(boolean arg);


  /**
    * The default playback rate for the media.  The Ogg backend does not support this.  1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster.  The value 0.0 is invalid and throws a NOT_SUPPORTED_ERR exception.
    */
  float getDefaultPlaybackRate();

  void setDefaultPlaybackRate(float arg);


  /**
    * The length of the media in seconds, or zero if no media data is available.  If the media data is available but the length is unknown, this value is NaN.  If the media is streamed and has no predefined length, the value is Inf.
    */
  float getDuration();


  /**
    * Indicates whether the media element has ended playback.
    */
  boolean isEnded();


  /**
    * The media error object for the most recent error, or null if there has not been an error.
    */
  MediaError getError();

  double getInitialTime();


  /**
    * Reflects the 

loop
 HTML attribute, indicating whether the media element should start over when it reaches the end.
    */
  boolean isLoop();

  void setLoop(boolean arg);

  String getMediaGroup();

  void setMediaGroup(String arg);


  /**
    * true if the audio is muted, and false otherwise.
    */
  boolean isMuted();

  void setMuted(boolean arg);


  /**
    * 

The current state of fetching the media over the network.

Constant Value Description
EMPTY 0 There is no data yet.  The readyState is also HAVE_NOTHING.
LOADING 1 The media is loading.
LOADED_METADATA 2 The media's metadata has been loaded.
LOADED_FIRST_FRAME 3 The media's first frame has been loaded.
LOADED 4 The media has been fully loaded.
*/ int getNetworkState(); EventListener getOnwebkitkeyadded(); void setOnwebkitkeyadded(EventListener arg); EventListener getOnwebkitkeyerror(); void setOnwebkitkeyerror(EventListener arg); EventListener getOnwebkitkeymessage(); void setOnwebkitkeymessage(EventListener arg); EventListener getOnwebkitneedkey(); void setOnwebkitneedkey(EventListener arg); EventListener getOnwebkitsourceclose(); void setOnwebkitsourceclose(EventListener arg); EventListener getOnwebkitsourceended(); void setOnwebkitsourceended(EventListener arg); EventListener getOnwebkitsourceopen(); void setOnwebkitsourceopen(EventListener arg); /** * Indicates whether the media element is paused. */ boolean isPaused(); /** * The current rate at which the media is being played back. This is used to implement user controls for fast forward, slow motion, and so forth. The normal playback rate is multiplied by this value to obtain the current rate, so a value of 1.0 indicates normal speed.  Not supported by the Ogg backend. */ float getPlaybackRate(); void setPlaybackRate(float arg); /** * The ranges of the media source that the browser has played, if any. */ TimeRanges getPlayed(); /** * Reflects the preload HTML attribute, indicating what data should be preloaded at page-load time, if any. */ String getPreload(); void setPreload(String arg); /** *

The readiness state of the media:

Constant Value Description
HAVE_NOTHING 0 No information is available about the media resource.
HAVE_METADATA 1 Enough of the media resource has been retrieved that the metadata attributes are initialized.  Seeking will no longer raise an exception.
HAVE_CURRENT_DATA 2 Data is available for the current playback position, but not enough to actually play more than one frame.
HAVE_FUTURE_DATA 3 Data for the current playback position as well as for at least a little bit of time into the future is available (in other words, at least two frames of video, for example).
HAVE_ENOUGH_DATA 4 Enough data is available—and the download rate is high enough—that the media can be played through to the end without interruption.
*/ int getReadyState(); /** * The time ranges that the user is able to seek to, if any. */ TimeRanges getSeekable(); /** * Indicates whether the media is in the process of seeking to a new position. */ boolean isSeeking(); /** * Reflects the src HTML attribute, containing the URL of a media resource to use. */ String getSrc(); void setSrc(String arg); /** * The earliest possible position in the media, in seconds. */ float getStartTime(); TextTrackList getTextTracks(); /** * The audio volume, from 0.0 (silent) to 1.0 (loudest). */ float getVolume(); void setVolume(float arg); int getWebkitAudioDecodedByteCount(); boolean isWebkitClosedCaptionsVisible(); void setWebkitClosedCaptionsVisible(boolean arg); boolean isWebkitHasClosedCaptions(); String getWebkitMediaSourceURL(); boolean isWebkitPreservesPitch(); void setWebkitPreservesPitch(boolean arg); int getWebkitSourceState(); int getWebkitVideoDecodedByteCount(); TextTrack addTextTrack(String kind); TextTrack addTextTrack(String kind, String label); TextTrack addTextTrack(String kind, String label, String language); /** * Determines whether the specified media type can be played back. */ String canPlayType(String type, String keySystem); /** * Begins loading the media content from the server. */ void load(); /** * Pauses the media playback. */ void pause(); /** * Begins playback of the media. If you have changed the src attribute of the media element since the page was loaded, you must call load() before play(), otherwise the original media plays again. */ void play(); void webkitAddKey(String keySystem, Uint8Array key); void webkitAddKey(String keySystem, Uint8Array key, Uint8Array initData, String sessionId); void webkitCancelKeyRequest(String keySystem, String sessionId); void webkitGenerateKeyRequest(String keySystem); void webkitGenerateKeyRequest(String keySystem, Uint8Array initData); void webkitSourceAbort(String id); void webkitSourceAddId(String id, String type); void webkitSourceAppend(String id, Uint8Array data); TimeRanges webkitSourceBuffered(String id); void webkitSourceEndOfStream(int status); void webkitSourceRemoveId(String id); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy