michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * The origin of this IDL file is michael@0: * http://www.whatwg.org/specs/web-apps/current-work/#media-elements michael@0: * michael@0: * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and michael@0: * Opera Software ASA. You are granted a license to use, reproduce michael@0: * and create derivative works of this document. michael@0: */ michael@0: michael@0: interface HTMLMediaElement : HTMLElement { michael@0: michael@0: // error state michael@0: readonly attribute MediaError? error; michael@0: michael@0: // network state michael@0: [SetterThrows] michael@0: attribute DOMString src; michael@0: readonly attribute DOMString currentSrc; michael@0: michael@0: [SetterThrows] michael@0: attribute DOMString crossOrigin; michael@0: const unsigned short NETWORK_EMPTY = 0; michael@0: const unsigned short NETWORK_IDLE = 1; michael@0: const unsigned short NETWORK_LOADING = 2; michael@0: const unsigned short NETWORK_NO_SOURCE = 3; michael@0: readonly attribute unsigned short networkState; michael@0: [SetterThrows] michael@0: attribute DOMString preload; michael@0: [NewObject] michael@0: readonly attribute TimeRanges buffered; michael@0: void load(); michael@0: DOMString canPlayType(DOMString type); michael@0: michael@0: // ready state michael@0: const unsigned short HAVE_NOTHING = 0; michael@0: const unsigned short HAVE_METADATA = 1; michael@0: const unsigned short HAVE_CURRENT_DATA = 2; michael@0: const unsigned short HAVE_FUTURE_DATA = 3; michael@0: const unsigned short HAVE_ENOUGH_DATA = 4; michael@0: readonly attribute unsigned short readyState; michael@0: readonly attribute boolean seeking; michael@0: michael@0: // playback state michael@0: [SetterThrows] michael@0: attribute double currentTime; michael@0: [Throws] michael@0: void fastSeek(double time); michael@0: readonly attribute unrestricted double duration; michael@0: // TODO: Bug 847376 - readonly attribute any startDate; michael@0: readonly attribute boolean paused; michael@0: [SetterThrows] michael@0: attribute double defaultPlaybackRate; michael@0: [SetterThrows] michael@0: attribute double playbackRate; michael@0: [NewObject] michael@0: readonly attribute TimeRanges played; michael@0: [NewObject] michael@0: readonly attribute TimeRanges seekable; michael@0: readonly attribute boolean ended; michael@0: [SetterThrows] michael@0: attribute boolean autoplay; michael@0: [SetterThrows] michael@0: attribute boolean loop; michael@0: [Throws] michael@0: void play(); michael@0: [Throws] michael@0: void pause(); michael@0: michael@0: // TODO: Bug 847377 - mediaGroup and MediaController michael@0: // media controller michael@0: // attribute DOMString mediaGroup; michael@0: // attribute MediaController? controller; michael@0: michael@0: // controls michael@0: [SetterThrows] michael@0: attribute boolean controls; michael@0: [SetterThrows] michael@0: attribute double volume; michael@0: attribute boolean muted; michael@0: [SetterThrows] michael@0: attribute boolean defaultMuted; michael@0: michael@0: // TODO: Bug 847379 michael@0: // tracks michael@0: //readonly attribute AudioTrackList audioTracks; michael@0: //readonly attribute VideoTrackList videoTracks; michael@0: [Pref="media.webvtt.enabled"] michael@0: readonly attribute TextTrackList textTracks; michael@0: [Pref="media.webvtt.enabled"] michael@0: TextTrack addTextTrack(TextTrackKind kind, michael@0: optional DOMString label = "", michael@0: optional DOMString language = ""); michael@0: }; michael@0: michael@0: // Mozilla extensions: michael@0: partial interface HTMLMediaElement { michael@0: attribute MediaStream? mozSrcObject; michael@0: attribute boolean mozPreservesPitch; michael@0: readonly attribute boolean mozAutoplayEnabled; michael@0: michael@0: // NB: for internal use with the video controls: michael@0: [Func="IsChromeOrXBL"] attribute boolean mozMediaStatisticsShowing; michael@0: [Func="IsChromeOrXBL"] attribute boolean mozAllowCasting; michael@0: [Func="IsChromeOrXBL"] attribute boolean mozIsCasting; michael@0: michael@0: // Mozilla extension: stream capture michael@0: [Throws] michael@0: MediaStream mozCaptureStream(); michael@0: [Throws] michael@0: MediaStream mozCaptureStreamUntilEnded(); michael@0: readonly attribute boolean mozAudioCaptured; michael@0: michael@0: // Mozilla extension: return embedded metadata from the stream as a michael@0: // JSObject with key:value pairs for each tag. This can be used by michael@0: // player interfaces to display the song title, artist, etc. michael@0: [Throws] michael@0: object? mozGetMetadata(); michael@0: michael@0: // Mozilla extension: provides access to the fragment end time if michael@0: // the media element has a fragment URI for the currentSrc, otherwise michael@0: // it is equal to the media duration. michael@0: readonly attribute double mozFragmentEnd; michael@0: michael@0: // Mozilla extension: an audio channel type for media elements. michael@0: // Read AudioChannel.webidl for more information about this attribute. michael@0: [SetterThrows] michael@0: attribute AudioChannel mozAudioChannelType; michael@0: michael@0: // In addition the media element has this new events: michael@0: // * onmozinterruptbegin - called when the media element is interrupted michael@0: // because of the audiochannel manager. michael@0: // * onmozinterruptend - called when the interruption is concluded michael@0: };