이 번역은 완료되지 않았습니다. 이 문서를 번역해 주세요.

HTML <source> 요소<picture>, <audio>, <video> 요소의 다중 미디어 리소스를 지정하기 위해 사용됩니다. 이것은 빈 요소 입니다. 이것은 일반적으로  다른 브라우저에서 지원하는 여러 포맷들을 통해 같은 미디어를 제공하기 위해 사용됩니다.

속성

이 요소는 전역 속성을 포함합니다.

sizes
Is a list of source sizes that describes the final rendered width of the image represented by the source. Each source size consists of a comma-separated list of media condition-length pairs. This information is used by the browser to determine, before laying the page out, which image defined in srcset to use.
The sizes attribute has an effect only when the <source> element is the direct child of a <picture> element.
src
<audio><video> 요소에 요구되며, 미디어 리소스의 주소를 지정합니다. 만약 <source> 요소가 <picture> 요소 내부에 있을경우, 이 속성은 무시됩니다.
srcset
쉼표로 구분된, 브라우저가 사용할수 있는 이미지 세트의 1개 이상의 문자열 목록. Each string is composed of:
  1. one URL to an image,
  2. a width descriptor, that is a positive integer directly followed by 'w'. The default value, if missing, is the infinity.
  3. a pixel density descriptor, that is a positive floating number directly followed by 'x'. The default value, if missing, is 1x.

Each string in the list must have at least a width descriptor or a pixel density descriptor to be valid. Among the list, there must be only one string containing the same tuple of width descriptor and pixel density descriptor.
The browser chooses the most adequate image to display at a given point of time.
The srcset attribute has an effect only when the <source> element is the direct child of a <picture> element.

type
리소스의 MIME 타입 (선택적으로 codecs 매개 변수도 함께). RFC 4281에 코덱을 어떻게 지정하는지에 대한 정보가 나와있습니다.
media
Media query of the resource's intended media; this should be used only in a <picture> element.

If the type attribute isn't specified, the media's type is retrieved from the server and checked to see if Gecko can handle it; if it can't be rendered, the next source is checked. If the type attribute is specified, it's compared against the types Gecko can play, and if it's not recognized, the server doesn't even get queried; instead, the next source element is checked at once.

예제

This example demonstrates how to offer a video in Ogg format for users whose browsers support Ogg format, and a QuickTime format video for users whose browsers support that. If the audio or video element is not supported by the browser, a notice is displayed instead.  If the browser supports the element but does not support any of the specified formats, an error event is raised and the default media controls (if enabled) will indicate an error. See also the list of media formats supported by the audio and video elements in various browsers.

<video controls>
  <source src="foo.webm" type="video/webm">
  <source src="foo.ogg" type="video/ogg"> 
  <source src="foo.mov" type="video/quicktime">
  죄송합니다. 당신의 브라우저는 HTML5 동영상을 지원하지 않습니다.
</video>

더 많은 예제를 보려면 Using audio and video in Firefox를 참조하세요

명세

사양 상태 주석
HTML Living Standard
The definition of '<source>' in that specification.
Living Standard Initial definition of <source> used inside a <picture> element.
HTML Living Standard
The definition of '<source>' in that specification.
Living Standard Initial definition of <source> used inside a media element, <audio> or <video>.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
sourceChrome Full support YesEdge Full support YesFirefox Full support 3.5
Notes
Full support 3.5
Notes
Notes Until Firefox 15, Firefox picked the first source element that has a type matching the MIME-type of a supported media format; see bug 449363 for details.
IE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4
Notes
Full support 4
Notes
Notes Until Firefox 15, Firefox picked the first source element that has a type matching the MIME-type of a supported media format; see bug 449363 for details.
Opera Android ? Safari iOS Full support YesSamsung Internet Android Full support Yes
mediaChrome Full support YesEdge Full support YesFirefox Full support 15IE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 15Opera Android ? Safari iOS Full support YesSamsung Internet Android Full support Yes
sizesChrome Full support YesEdge Full support YesFirefox Full support 38
Full support 38
Full support 33
Disabled
Disabled From version 33: this feature is behind the dom.image.picture.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE ? Opera ? Safari Full support 9
Full support 9
Partial support 7
WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 38
Full support 38
Full support 33
Disabled
Disabled From version 33: this feature is behind the dom.image.picture.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android ? Safari iOS Full support 9.2
Full support 9.2
Partial support 8
Samsung Internet Android Full support Yes
srcChrome Full support YesEdge Full support YesFirefox Full support 3.5IE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android ? Safari iOS Full support YesSamsung Internet Android Full support Yes
srcsetChrome Full support YesEdge Full support YesFirefox Full support 38
Full support 38
Full support 33
Disabled
Disabled From version 33: this feature is behind the dom.image.picture.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE ? Opera ? Safari Full support 9
Full support 9
Partial support 7
WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 38
Full support 38
Full support 33
Disabled
Disabled From version 33: this feature is behind the dom.image.picture.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android ? Safari iOS Full support 9.2
Full support 9.2
Partial support 8
Samsung Internet Android Full support Yes
typeChrome Full support YesEdge Full support YesFirefox Full support 3.5IE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android ? Safari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.

같이 보기

문서 태그 및 공헌자

태그: 
이 페이지의 공헌자: alattalatta, mdnwebdocs-bot, azunyan3
최종 변경자: alattalatta,