docs.rodeo

MDN Web Docs mirror

HTMLMediaElement: canPlayType() method

{{APIRef("HTML DOM")}} 

The {{domxref("HTMLMediaElement")}}  method canPlayType() reports how likely it is that the current browser will be able to play media of a given MIME type.

Syntax

canPlayType(type)

Parameters

Return value

A string indicating how likely it is that the media can be played. The string will be one of the following values:

Examples

let obj = document.createElement("video");
console.log(obj.canPlayType("video/mp4")); // "maybe"

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN