In this guide
Preserve the exact type questionClassify the real playback failureAsk a more specific question when appropriateA browser returning probably from canPlayType has assessed a media-type description. It has not inspected every byte of the chosen stream or verified the network and account path. Playback can still fail for reasons outside that query.
The useful response is to compare the exact question with the actual selected media, then inspect the real failure. Repeating the same capability query cannot resolve an HTTP authorization error or repair invalid media.
Preserve the exact type question
Record the MIME type and codecs parameter supplied to canPlayType. A query for video/mp4 is broader than one describing a specific video and audio configuration. Check whether the actual media’s declared tracks match the query, including audio rather than only video.
In an original hypothetical case, a web page asks about an MP4 type with a common video codec but omits the audio format. The actual file contains an audio track the playback path cannot use. A favorable video-focused hint does not establish support for that complete audio/video combination.
Classify the real playback failure
If the resource returns 403, the browser reached a server that refused the request; canPlayType did not test permission. If the response is a login page with status 200, the media parser still does not receive the expected payload. If media arrives and a decode error follows, the relevant evidence is the selected configuration and the decoder failure.
A blocked automatic play attempt is another separate outcome. Browser interaction policy can reject play even when the format is supported. Record the rejected play promise or documented player message rather than relabelling it as a codec failure.
Ask a more specific question when appropriate
For a developer-controlled player, MediaCapabilities can assess a fuller configuration, including dimensions, rate and frame rate. Its response remains a browser-reported capability assessment, not a service performance certification. Keep actual playback diagnostics alongside it.
A useful issue report contains the exact canPlayType input/output, actual selected format, request outcome and media error. This lets a developer distinguish inaccurate type metadata, unsupported configuration, content access, invalid payload and interaction policy. Avoid a blanket compatibility claim based on one favorable string result.
- Save the exact MIME and codec query.
- Compare it with the actual selected tracks.
- Classify the request, policy or decode failure separately.
- Use a fuller capability query only for the configuration question.
