# Global

##

### Members

#### (constant) Tracks

Used across all providers for loading tracks and handling browser track-related events

### Methods

#### coreFactory(api, element)

Factory method which creates controllers before calling `jwplayer().setup()`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`api` | Api |
`element` | HTMLElement |

#### filterPlaylist()

Go through the playlist and choose a single playable type to play; remove sources of a different type

#### jwplayer(queryopt) → {Api|object}

Return an instance of the JW Player API matching an element on the page or an existing player.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`query` | string | number | HTMLElement | <optional> | This can be an element id, player index or DOM element. When left out, this method attempts to return the first available player.

##### Returns:

- Returns a player instance if one matches the provided query. Otherwise, returns an object containing the `registerPlugin` method.

Type
  Api | object

#### removePlayer(api)

Removes the Api instance from the list of active players. The instance will no longer be queryable via `jwplayer()`

##### Parameters:

Name | Type | Description
--- | --- | ---
`api` | Api |

#### resetPlayer(api, core)

Detaches Api event listeners and destroys the controller.

##### Parameters:

Name | Type | Description
--- | --- | ---
`api` | Api |
`core` | Core |

### Type Definitions

#### AudioTrackOption

Audio Track information for tracks returned by jwplayer().getAudioTracks()

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`autoselect` |  |
`defaulttrack` |  |
`groupid` |  |
`language` | string |
`name` | string |

#### BrowserEnvironment

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`androidNative` | boolean | Is the browser Android Native?
`chrome` | boolean | Is the browser Chrome?
`edge` | boolean | Is the browser Edge?
`facebook` | boolean | Is the browser a Facebook webview?
`firefox` | boolean | Is the browser Firefox?
`ie` | boolean | Is the browser Internet Explorer?
`msie` | boolean | Is the browser MSIE?
`safari` | boolean | Is the browser Safari?
`version` | EnvironmentVersion | The browser version.

#### CaptionsTrackOption

Captions Track information for tracks returned by jwplayer().getCaptionsList()

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`id` | string |
`label` | string |

#### Environment

Environment information for the current session, return by jwplayer().getEnvironment()

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`Browser` | BrowserEnvironment | Information about the current session's browser.
`OS` | OSEnvironment | Information about the current session's operating system.
`Features` | FeatureEnvironment | Information about the current sessions's supported features.

#### EnvironmentVersion

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`version` | string | The full version string.
`major` | number | The major version.
`minor` | number | The minor version.

#### FeatureEnvironment

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`flash` | boolean | Does the browser environment support Flash?
`flashVersion` | number | The version of Flash.
`iframe` | boolean | Is the session in an iframe?

#### OSEnvironment

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`android` | boolean | Is the operating system Android?
`iOS` | boolean | Is the operating system iOS?
`mobile` | boolean | Is the operating system iOS or Android?
`osx` | boolean | Is the operating system Mac OS X?
`iPad` | boolean | Is the device an iPad?
`iPhone` | boolean | Is the device an iPhone?
`windows` | boolean | Is the operating system Windows?
`version` | EnvironmentVersion | The operating system version.

#### PlayerQoE

Player QoE returned from jwplayer().qoe()

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`setupTime` | number | The number of milliseconds from `jwplayer().setup()` to the "ready" event.
`firstFrame` | number | The number of milliseconds from the "playAttempt" event to the "firstFrame" event.
`player` | TimerMetrics | The QoE metrics of the player.
`item` | TimerMetrics | The QoE metrics of the current playlist item.

#### PlaylistItem

An item in the playlist

##### Type:

- object

##### Properties:

Name | Type | Attributes | Description
--- | --- | --- | ---
`sources` | Array.<PlaylistItemSource> |  | A list of alternative media sources for the player to choose from.
`tracks` | Array.<PlaylistItemTrack> |  | A list of tracks associated with this item.
`file` | string |  | The selected source URL to be played.
`image` | string | <optional> | The poster image.
`preload` | 'none' | 'metadata' | 'auto' |  | The selected preload setting.
`minDvrWindow` | number |  | For live streams, the threshold at which the available media should be seekable, and treated as a DVR stream.

#### PlaylistItemSource

A media source variant present in a playlist item

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`file` | string | The media URL.
`type` | string | The type (common file extension) of media.
`default` | boolean | Default sources are prioritized over others.
`label` | string | The quality label to be used with multiple mp4/webm sources.

#### PlaylistItemTrack

A media source variant present in a playlist item

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`kind` | 'captions' | 'subtitles' | 'chapters' | 'thumbnails' | The kind of track.
`default` | boolean | Enable the track by default.

#### ProviderInfo

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`name` | string | The name of the Provider handling playback.

#### QualityOption

##### Type:

- option

##### Properties:

Name | Type | Attributes | Description
--- | --- | --- | ---
`label` | string |  |
`width` | number | <optional> |
`height` | number | <optional> |
`bitrate` | number | <optional> |

#### SafeRegion

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`x` | number | The position in pixels from the left of the player, not covered by controls.
`y` | number | The position in pixels from the top of the player, not covered by controls.
`width` | number | The width of the safe region.
`height` | number | The height of the safe region.

#### SliderCue

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`begin` | number | The time at which the cue should be placed in seconds.
`text` | string | The text label of the cue.

#### TimerMetrics

QoE metrics returned by `jwplayer()._qoe.dump()`. jwplayer().qoe():PlayerQoE returns these for the player and the current playlist item.

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`counts` | object | Lists event counts by event name
`events` | object | Lists last event timestamps (epoch ms) by event name
`sums` | object | Lists total event/state duration by event/state name

#### VisualQuality

##### Type:

- object

##### Properties:

Name | Type | Attributes | Description
--- | --- | --- | ---
`level` | QualityOption |  | The quality option associated with the active visual quality.
`mode` | 'auto' | 'manual' |  | Whether the quality was selected automatically (adaptive quality switch) or manually.
`reason` | string | 'initial choice' | 'auto' | 'api' |  | The reason for the quality change.
`bitrate` | number | <optional> | The bitrate of the the active visual quality.