# API and Configuration * [Attributes](#attributes) * [Configuration](#development) * [Standalone](#standalone) * [MediaElementPlayer](#player) * [API](#api) * [Properties](#properties) * [Methods](#methods) * [Events](#events) ## Attributes `MediaElement` supports the following `video`/`audio` tag attributes: Attribute | Description -------- | ------------ autoplay | Specifies that the video will start playing as soon as it is ready class | Specifies one or more class names for an element (refers to a class in a style sheet) controls | Specifies that video controls should be displayed (such as a play/pause button etc). id | Specifies a unique id for an element; if not specified, the plugin will create one automatically height | Sets the height of the video player in pixels; you can also indicate percentages loop | Specifies that the video will start over again, every time it is finished muted | Specifies that the audio output of the video should be muted poster | Specifies an image to be shown while the video is downloading, or until the user hits the play button. Generally, a PNG or JPEG image. If not specified, the player will use the background color specified in the style sheet preload | Specifies if and how the author thinks the video should be loaded when the page loads; possible values: `auto`, `metadata` or `none` (recommended) src | Specifies the URL of the video file; this value can also be indicated with `source` tags (refer to the [Multiple Codecs](installation.md#multi-codecs) section for more information) style | Specifies an inline CSS style for an element tabindex | Specifies the tabbing order of an element. To avoid the keyboard to focus on this element, use `-1`; otherwise, `0` title | Specifies extra information about an element width | Sets the width of the video player in pixels; you can also indicate percentages The following markup displays all the attributes listed above for more clarity: ```html ``` ## Configuration ### Standalone As a standalone library, _MediaElement.js_ can be configured using the following settings. Parameter | Type | Default | Description ------ | --------- | ------- | -------- renderers | array | `[]` | List of the renderers to use fakeNodeName | string | `mediaelementwrapper` | Name of MediaElement container pluginPath | string | `build/` | Path where Flash shims are located shimScriptAccess | string | `sameDomain` | Flag in `` and `` to determine whether to use local or CDN files. Possible values: `always` (CDN version) or `sameDomain` (local files) success | callback | | Action(s) that will be executed as soon as the source is loaded; passes 2 arguments: `media` (the wrapper that mimics all the native events/properties/methods for all renderers) and `node` (the original HTML `video`, `audio` or `iframe` tag where the media was loaded originally; if `html5` is being used, `media` and `node` are the basically the same) error | callback | | Action(s) that will be executed if source doesn't load for any reason. Passes same arguments as `success` dailymotion | object | | See [Documentation](https://developer.dailymotion.com/player) dash | object | | Accepts `debug`, `drm` (object to load protected/licensed streaming; read [here](https://github.com/Axinom/drm-quick-start) for more information) and `path` parameters to indicate `dash.js` URL/local path facebook | object | | See [Documentation](https://developers.facebook.com/docs/plugins/embedded-video-player/api#setup) (and a custom `lang` parameter to indicate the FB SDK language) flv | object | | See [Documentation](https://github.com/Bilibili/flv.js/blob/master/docs/api.md) (and a custom `path` parameter to indicate where to load library) hls | object | | See [Documentation](https://github.com/dailymotion/hls.js/blob/master/API.md#fine-tuning) (and a custom `path` parameter to indicate where to load library) youtube | object | | See [Documentation](https://developers.google.com/youtube/player_parameters#Parameters); also, a custom `nocookie` parameter to switch to YouTube's no-cookie URL and `imageQuality` parameter if user decides to use Image API to load a YouTube poster based on YouTube video ID (possible values: `default`, `hqdefault`, `mqdefault`, `sddefault` and `maxresdefault`) **Notes** 1. Vimeo and Soundcloud don't need any configuration for now since they are pretty straight forward. 2. To use DRM with M(PEG)-DASH, make sure CORS are configured correctly, and also your site **MUST** be using SSL. 3. Both `success` and `error` will be available for both `MediaElement` and `MediaElementPlayer`; however, when using `MediaElementPlayer`, a third argument is passed: `instance`, which gives access to the methods associated to the `MediaElementPlayer` class. 4. When using `MediaElementPlayer`, `error` arguments will be: `error` (the details on the error event), `media` and `node`. ### MediaElementPlayer Including the above, _MediaElementPlayer_ object allows the following extra configuration elements. Parameter | Type | Default | Description ------ | --------- | ------- | -------- classPrefix | string | `mejs__` | Class prefix for player elements poster | string | _(empty)_ | Poster URL that overrides `poster` attribute showPosterWhenEnded | boolean | `false` | When the video is ended, show the poster showPosterWhenPaused | boolean | `false` | When the video is paused, show the poster defaultVideoWidth | number | `480` | Default width if the `