@@ -814,14 +814,56 @@ class type tableElement = object
814814 method deleteRow : int -> unit meth
815815end
816816
817+ class type timeRanges = object
818+ method length : int readonly_prop
819+ method start : int -> float meth
820+ method end_ : int -> float meth
821+ end
822+
823+ type networkState =
824+ | NETWORK_EMPTY
825+ | NETWORK_IDLE
826+ | NETWORK_LOADING
827+ | NETWORK_NO_SOURCE
817828
829+ type readyState =
830+ | HAVE_NOTHING
831+ | HAVE_METADATA
832+ | HAVE_CURRENT_DATA
833+ | HAVE_FUTURE_DATA
834+ | HAVE_ENOUGH_DATA
835+
836+ (* http://www.w3schools.com/tags/ref_av_dom.asp *)
837+ (* only features supported by all browser. (IE9+) *)
818838class type mediaElement = object
819839 inherit element
820- method currentTime : float prop
821- method duration : float prop
840+ method canPlayType : js_string t -> js_string t meth
841+ method load : unit meth
822842 method play : unit meth
823843 method pause : unit meth
824844
845+ method autoplay : bool t prop
846+ method buffered : timeRanges t readonly_prop
847+ method controls : bool t prop
848+ method currentSrc : js_string t readonly_prop
849+ method currentTime : float prop
850+ method duration : float readonly_prop
851+ method ended : bool t readonly_prop
852+ method loop : bool t prop
853+ method mediagroup : js_string t prop
854+ method muted : bool t prop
855+ method networkState_int : int readonly_prop
856+ method networkState : networkState readonly_prop
857+ method paused : bool t readonly_prop
858+ method playbackRate : float prop
859+ method played : timeRanges t readonly_prop
860+ method preload : js_string t prop
861+ method readyState_int : int readonly_prop
862+ method readyState : readyState readonly_prop
863+ method seekable : timeRanges t readonly_prop
864+ method seeking : bool t readonly_prop
865+ method src : js_string t prop
866+ method volume : float prop
825867end
826868
827869class type audioElement = object
@@ -1296,6 +1338,8 @@ let createAddress doc = createElement doc "address"
12961338let createFrameset doc : frameSetElement t = unsafeCreateElement doc " frameset"
12971339let createFrame doc : frameElement t = unsafeCreateElement doc " frame"
12981340let createIframe doc : iFrameElement t = unsafeCreateElement doc " iframe"
1341+ let createAudio doc : audioElement t = unsafeCreateElement doc " audio"
1342+ let createVideo doc : audioElement t = unsafeCreateElement doc " video"
12991343
13001344exception Canvas_not_available
13011345
@@ -1385,6 +1429,8 @@ module CoerceTo = struct
13851429 let title e = unsafeCoerce " title" e
13861430 let tr e = unsafeCoerce " tr" e
13871431 let ul e = unsafeCoerce " ul" e
1432+ let audio e = unsafeCoerce " audio" e
1433+ let video e = unsafeCoerce " video" e
13881434
13891435 let unsafeCoerceEvent constr (ev : #event t ) =
13901436 if def constr != undefined && Js. instanceof ev constr then
@@ -1478,6 +1524,7 @@ let element : #Dom.element t -> element t = Js.Unsafe.coerce
14781524type taggedElement =
14791525 | A of anchorElement t
14801526 | Area of areaElement t
1527+ | Audio of audioElement t
14811528 | Base of baseElement t
14821529 | Blockquote of quoteElement t
14831530 | Body of bodyElement t
@@ -1535,6 +1582,7 @@ type taggedElement =
15351582 | Title of titleElement t
15361583 | Tr of tableRowElement t
15371584 | Ul of uListElement t
1585+ | Video of videoElement t
15381586 | Other of element t
15391587
15401588let other e = Other (e : #element t :> element t )
@@ -1549,6 +1597,7 @@ let tagged (e : #element t) =
15491597 begin match tag with
15501598 | "a" -> A (Js.Unsafe. coerce e)
15511599 | "area" -> Area (Js.Unsafe. coerce e)
1600+ | "audio" -> Audio (Js.Unsafe. coerce e)
15521601 | _ -> other e
15531602 end
15541603 | 'b' ->
@@ -1668,6 +1717,11 @@ let tagged (e : #element t) =
16681717 | "ul" -> Ul (Js.Unsafe. coerce e)
16691718 | _ -> other e
16701719 end
1720+ | 'v' ->
1721+ begin match tag with
1722+ | "video" -> Video (Js.Unsafe. coerce e)
1723+ | _ -> other e
1724+ end
16711725 | _ ->
16721726 other e
16731727
0 commit comments