HTML5 Video element is really cool! Here are the interfaces which need to be implemented in C++. Also for JavaScript programmer as a reference.
The attributes marked with purple color below are Event Handle! which means you can use method videoElement.addEventListener to listen to the corresponding event of the player element. For example: videoElement.addEventListener('error', youHandler, false).
interfaceHTMLMediaElement: HTMLElement { //<video></video>
// error state
readonly attribute MediaError error;
// network state
attribute DOMString src;
readonly attribute DOMString currentSrc;
const unsigned short NETWORK_EMPTY = 0;
const unsigned short NETWORK_IDLE = 1;
const unsigned short NETWORK_LOADING = 2;
const unsigned short NETWORK_NO_SOURCE = 3;
readonly attribute unsigned short networkState;
attribute DOMString preload;
readonly attributeTimeRangesbuffered; //for the progress bar
void load();
DOMString canPlayType(in DOMString type);
// ready state
const unsigned short HAVE_NOTHING = 0;
const unsigned short HAVE_METADATA = 1;
const unsigned short HAVE_CURRENT_DATA = 2;
const unsigned short HAVE_FUTURE_DATA = 3;
const unsigned short HAVE_ENOUGH_DATA = 4;
readonly attribute unsigned short readyState;
readonly attribute boolean seeking;
// playback state
attribute double currentTime;
readonly attribute double initialTime;
readonly attribute double duration;
readonly attribute Date startOffsetTime;
readonly attribute boolean paused;
attribute double defaultPlaybackRate;
attribute double playbackRate;
readonly attribute TimeRanges played;
readonly attribute TimeRanges seekable;
readonly attribute boolean ended;
attribute boolean autoplay;
attribute boolean loop;
void play();
void pause();
// media controller
attribute DOMString mediaGroup;
attributeMediaControllercontroller; //the control panel
// controls
attribute boolean controls;
attribute double volume;
attribute boolean muted;
attribute boolean defaultMuted;
// tracks //for subtitles
readonly attributeMultipleTrackListaudioTracks;
readonly attributeExclusiveTrackListvideoTracks;
readonly attributeTextTrack[] textTracks;
MutableTextTrackaddTextTrack(in DOMString kind, in optional DOMString label, in optional DOMString language);
};
//webkit has this private method (need to catch error when call it - error means video is not ready yet)
void webkitEnterFullScreen();
interfaceMediaError{
const unsigned short MEDIA_ERR_ABORTED = 1;
const unsigned short MEDIA_ERR_NETWORK = 2;
const unsigned short MEDIA_ERR_DECODE = 3;
const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
readonly attribute unsigned shortcode;
};
interfaceTimeRanges{
readonly attribute unsigned longlength;
doublestart(in unsigned long index);
doubleend(in unsigned long index);
};
interfaceMediaController{
readonly attribute TimeRanges buffered;
readonly attribute TimeRanges seekable;
readonly attribute double duration;
attribute double currentTime;
readonly attribute boolean paused;
readonly attribute TimeRanges played;
void play();
void pause();
attribute double defaultPlaybackRate;
attribute double playbackRate;
attribute double volume;
attribute boolean muted;
attribute Function onemptied;
attribute Function onloadedmetadata;
attribute Function onloadeddata;
attribute Function oncanplay;
attribute Function oncanplaythrough;
attribute Function onplaying;
attribute Function onwaiting;
attribute Function ondurationchange;
attribute Function ontimeupdate;
attribute Function onplay;
attribute Function onpause;
attribute Function onratechange;
attribute Function onvolumechange;
};
interfaceTrackList{
readonly attribute unsigned long length;
DOMString getID(in unsigned long index);
DOMString getKind(in unsigned long index);
DOMString getLabel(in unsigned long index);
DOMString getLanguage(in unsigned long index);
attribute Function onchange;
};
interfaceMultipleTrackList:TrackList{
boolean isEnabled(in unsigned long index);
void enable(in unsigned long index);
void disable(in unsigned long index);
};
interfaceExclusiveTrackList:TrackList{
readonly attribute unsigned long selectedIndex;
void select(in unsigned long index);
};
interfaceTextTrack{
readonly attribute DOMString kind;
readonly attribute DOMString label;
readonly attribute DOMString language;
const unsigned short NONE = 0;
const unsigned short LOADING = 1;
const unsigned short LOADED = 2;
const unsigned short ERROR = 3;
readonly attribute unsigned short readyState;
attribute Function onload;
attribute Function onerror;
const unsigned short OFF = 0;
const unsigned short HIDDEN = 1;
const unsigned short SHOWING = 2;
attribute unsigned short mode;
readonly attribute TextTrackCueList cues;
readonly attribute TextTrackCueList activeCues;
attribute Function oncuechange;
};
TextTrackimplements EventTarget;
interfaceMutableTextTrack:TextTrack{
void addCue(in TextTrackCue cue);
void removeCue(in TextTrackCue cue);
};
interface TextTrackCue {
readonly attribute TextTrack track;
readonly attribute DOMString id;
readonly attribute double startTime;
readonly attribute double endTime;
readonly attribute boolean pauseOnExit;
DOMString getCueAsSource();
DocumentFragment getCueAsHTML();
attribute Function onenter;
attribute Function onexit;
};
TextTrackCue implements EventTarget;
Yep, really long! actually you can read the first section of 'HTMLMediaElement' only, enjoy!