Module Media.El

The HTML media element interface.

Warning. This binding is incomplete, the modules Audio_track, Video_track, Text_track are mostly empty.


module Error : sig ... end

Media errors

module Can_play : sig ... end

Can play enum.

module Have : sig ... end

Ready state codes.

module Network : sig ... end

Network state codes.

module Cors : sig ... end

CORS settings

module Provider : sig ... end

Media providers.

module Audio_track : sig ... end

Audio tracks (incomplete).

module Video_track : sig ... end

Video tracks (incomplete).

module Text_track : sig ... end

Text tracks (incomplete).

module Time_ranges : sig ... end

Time ranges.

Media interface

type t

The type for elements satifying the HTMLMediaElement interface.

val of_el : Brr.El.t -> t

of_el e is the media interface of e. This throws a JavaScript error if e is not a or element.

val to_el : t -> Brr.El.t

to_el m is m as an an element.

Error state

val error : t -> Error.t option

error m is the most recent error of m.

Network state

val src : t -> Jstr.t

src m is the URI source of the played media.

val set_src : t -> Jstr.t -> unit

set_src m s sets the src of m to s.

val src_object : t -> Provider.t option

src_object m s is the source object of m.

val set_src_object : t -> Provider.t option -> unit

set_src_object m o sets the src_object of m to o.

val current_src : t -> Jstr.t

current_src m is the current source of m.

val cross_origin : t -> Cors.t

cross_origin m is the CORS setting of m.

val set_cross_origin : t -> Cors.t -> unit

set_cross_origin m c sets the cross_origin of m to c.

val network_state : t -> Network.t

network_state m is the network state of m.

val preload : t -> Jstr.t

preload m is the preload state of m.

val set_preload : t -> Jstr.t -> unit

set_preload m p sets the preload of m to p.

val buffered : t -> Time_ranges.t

buffered m are the ranges of media that are buffered:

val load : t -> unit

load m restarts loading m.

val can_play_type : t -> Jstr.t -> Can_play.t

can_play_type m t indicates if m can play t.

Ready state

val ready_state : t -> Have.t

ready_state m indicates the readiness of m.

val seeking : t -> bool

seeking m indicates m is seeking a new position.

Playback state

val current_time_s : t -> float

current_time m is the current time of m.

val set_current_time_s : t -> float -> unit

set_current_time_s m t sets the current_time of m to t.

val fast_seek_s : t -> float -> unit

fast_seek_s m t seeks m to t.

val duration_s : t -> float

duration_s m is the duration of m.

val paused : t -> bool

paused m indicates whether m is paused.

val default_playback_rate : t -> float

default_playback_rate m is the default playback rate of m.

val set_default_playback_rate : t -> float -> unit

set_default_playback_rate m sets the default_playback_rate of m.

val playback_rate : t -> float

playback_rate m is the playback rate of m.

val set_playback_rate : t -> float -> unit

set_playback_rate m sets the playback_rate of m.

val played : t -> Time_ranges.t

played m are the ranges that have been played.

val seekable : t -> Time_ranges.t

seekable m indicates the time ranges that are seekable.

val ended : t -> bool

ended m is true if the media has finished playing.

val autoplay : t -> bool

autoplay m is the autoplay behaviour of m.

val set_auto_play : t -> bool -> unit

set_auto_play m b sets autoplay of m to b.

val loop : t -> bool

loop m inidicates if m is set to loop.

val set_loop : t -> bool -> unit

set_loop m b sets the loop of m to b.

val play : t -> unit Fut.or_error

play m plays m.

val pause : t -> unit

pause m pauses m.


val controls : t -> bool

controls m indicates if media controls are shown.

val set_controls : t -> bool -> unit

set_controls m b sets the controls of m to b.

val volume : t -> float

volume m is the volume of m.

val set_volume : t -> float -> unit

set_volume m b sets the volume of m to b.

val muted : t -> bool

muted m indicates whether audio is muted.

val set_muted : t -> bool -> unit

set_muted m b sets the muted of m to b.

val default_muted : t -> bool

default_muted m is the default muted state.

val set_default_muted : t -> bool -> unit

set_default_muted m b sets the default_muted of m to b.


val audio_track_list : t -> Audio_track.List.t

audio_track_list m are the audio tracks of m.

val video_track_list : t -> Video_track.List.t

video_track_list m are the video tracks of m.

val text_track_list : t -> Text_track.List.t

text_trac_list m are the text tracks of m.

val capture_stream : t -> Stream.t

capture_tream m is a media stream for m.