# Media

The media module implements the behaviour of the <audio> and <video> media elements introduced in HTML 5. It is written with the `HTMLMediaElement` DOM interface in mind, but the basic behaviour of the elements should not dependend on the DOM or scripting. Much of the behaviour of the media elements is triggered by the DOM, changes to the document structure, etc. The code which detects such conditions can be found mainly in the dom and logdoc and doc modules, but the actual response to such conditions should be handled by this module.

## API

The module exposes the `MediaElement` interface, see the auto-generated API documentation.

## Memory

Note: Platform implementations may differ from the below.

### OOM handling

OOM condition is signalled via `OpStatus`. The Media module itself takes no special action for an OOM condition, except to try to not crash.

### Memory usage

#### Heap

At least one uncompressed video frame will be kept in memory.

#### Stack

No recursive algorithms are used, so stack depth should be minimal.

#### Static

There are no static arrays.

#### Freeing

All memory is freed when the `MediaElement` object is destroyed.

#### Tuning

None

#### Tests

None