Source type Property

❮ Source Object

Example

Return the MIME type of a media resource:

var x = document.getElementById("mySource").type;
Try it Yourself »

Description

The type property sets or returns the value of the type attribute in a <source> element.

The type attribute specifies the MIME type of the media resource.


Browser Support

Property
type Yes Yes Yes Yes Yes

Syntax

Return the type property:

sourceObject.type

Set the type property:

sourceObject.type = MIME_type

Property Values

Value Description
MIME_type Specifies the MIME type of the media resource.

Common MIME types:
For video:
  • video/ogg
  • video/mp4
  • video/webm
For audio:
  • audio/ogg
  • audio/mpeg
Look at IANA MIME types for a complete list of standard MIME types

Technical Details

Return Value: A String, representing the MIME type of the media resource

Related Pages

HTML reference: HTML <source> type attribute


❮ Source Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.