Module Media.ElSource

The HTML media element interface.

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

Preliminaries

Sourcemodule Error : sig ... end

Media errors

Sourcemodule Can_play : sig ... end

Can play enum.

Sourcemodule Have : sig ... end

Ready state codes.

Sourcemodule Network : sig ... end

Network state codes.

Sourcemodule Cors : sig ... end

CORS settings

Sourcemodule Provider : sig ... end

Media providers.

Sourcemodule Audio_track : sig ... end

Audio tracks (incomplete).

Sourcemodule Video_track : sig ... end

Video tracks (incomplete).

Sourcemodule Text_track : sig ... end

Text tracks (incomplete).

Sourcemodule Time_ranges : sig ... end

Time ranges.

Media interface

Sourcetype t

The type for elements satifying the HTMLMediaElement interface.

Sourceval 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 Brr.El.audio or Brr.El.video element.

Sourceval to_el : t -> Brr.El.t

to_el m is m as an an element.

Error state

Sourceval error : t -> Error.t option

error m is the most recent error of m.

Network state

Sourceval src : t -> Jstr.t

src m is the URI source of the played media.

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

set_src m s sets the src of m to s.

Sourceval src_object : t -> Provider.t option

src_object m s is the source object of m.

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

set_src_object m o sets the src_object of m to o.

Sourceval current_src : t -> Jstr.t

current_src m is the current source of m.

Sourceval cross_origin : t -> Cors.t

cross_origin m is the CORS setting of m.

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

set_cross_origin m c sets the cross_origin of m to c.

Sourceval network_state : t -> Network.t

network_state m is the network state of m.

Sourceval preload : t -> Jstr.t

preload m is the preload state of m.

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

set_preload m p sets the preload of m to p.

Sourceval buffered : t -> Time_ranges.t

buffered m are the ranges of media that are buffered:

Sourceval load : t -> unit

load m restarts loading m.

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

can_play_type m t indicates if m can play t.

Ready state

Sourceval ready_state : t -> Have.t

ready_state m indicates the readiness of m.

Sourceval seeking : t -> bool

seeking m indicates m is seeking a new position.

Playback state

Sourceval current_time_s : t -> float

current_time m is the current time of m.

Sourceval set_current_time_s : t -> float -> unit

set_current_time_s m t sets the current_time_s of m to t.

Sourceval fast_seek_s : t -> float -> unit

fast_seek_s m t seeks m to t.

Sourceval duration_s : t -> float

duration_s m is the duration of m.

Sourceval paused : t -> bool

paused m indicates whether m is paused.

Sourceval default_playback_rate : t -> float

default_playback_rate m is the default playback rate of m.

Sourceval set_default_playback_rate : t -> float -> unit

set_default_playback_rate m sets the default_playback_rate of m.

Sourceval playback_rate : t -> float

playback_rate m is the playback rate of m.

Sourceval set_playback_rate : t -> float -> unit

set_playback_rate m sets the playback_rate of m.

Sourceval played : t -> Time_ranges.t

played m are the ranges that have been played.

Sourceval seekable : t -> Time_ranges.t

seekable m indicates the time ranges that are seekable.

Sourceval ended : t -> bool

ended m is true if the media has finished playing.

Sourceval autoplay : t -> bool

autoplay m is the autoplay behaviour of m.

Sourceval set_auto_play : t -> bool -> unit

set_auto_play m b sets autoplay of m to b.

Sourceval loop : t -> bool

loop m inidicates if m is set to loop.

Sourceval set_loop : t -> bool -> unit

set_loop m b sets the loop of m to b.

Sourceval play : t -> unit Fut.or_error

play m plays m.

Sourceval pause : t -> unit

pause m pauses m.

Controls

Sourceval controls : t -> bool

controls m indicates if media controls are shown.

Sourceval set_controls : t -> bool -> unit

set_controls m b sets the controls of m to b.

Sourceval volume : t -> float

volume m is the volume of m.

Sourceval set_volume : t -> float -> unit

set_volume m b sets the volume of m to b.

Sourceval muted : t -> bool

muted m indicates whether audio is muted.

Sourceval set_muted : t -> bool -> unit

set_muted m b sets the muted of m to b.

Sourceval default_muted : t -> bool

default_muted m is the default muted state.

Sourceval set_default_muted : t -> bool -> unit

set_default_muted m b sets the default_muted of m to b.

Tracks

Sourceval audio_track_list : t -> Audio_track.List.t

audio_track_list m are the audio tracks of m.

Sourceval video_track_list : t -> Video_track.List.t

video_track_list m are the video tracks of m.

Sourceval text_track_list : t -> Text_track.List.t

text_trac_list m are the text tracks of m.

Sourceval capture_stream : t -> Stream.t

capture_tream m is a media stream for m.